diff options
author | Benoit Giannangeli <giann008@gmail.com> | 2017-10-09 07:49:20 +0200 |
---|---|---|
committer | Benoit Giannangeli <giann008@gmail.com> | 2017-11-09 12:56:17 +0100 |
commit | 97a52383d4194678b781e8826c6512fc6fe40288 (patch) | |
tree | 1ddc466da9adde4e2025cddd591ad85e0b3ff0ac /src/lstrlib.js | |
parent | a5d5b5f695ad557e25911f08be2d132ab1be658c (diff) | |
download | fengari-97a52383d4194678b781e8826c6512fc6fe40288.tar.gz fengari-97a52383d4194678b781e8826c6512fc6fe40288.tar.bz2 fengari-97a52383d4194678b781e8826c6512fc6fe40288.zip |
Removed incorrect use of llimits.MAX/MIN_INT
llimit.js is renamed to llimits.js
Diffstat (limited to 'src/lstrlib.js')
-rw-r--r-- | src/lstrlib.js | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/lstrlib.js b/src/lstrlib.js index 7a2283c..17ee999 100644 --- a/src/lstrlib.js +++ b/src/lstrlib.js @@ -6,7 +6,6 @@ const sprintf = require('sprintf-js').sprintf; const lauxlib = require('./lauxlib.js'); const lua = require('./lua.js'); const luaconf = require('./luaconf.js'); -const llimit = require('./llimit.js'); const sL_ESC = '%'; const L_ESC = sL_ESC.charCodeAt(0); @@ -224,7 +223,7 @@ const addliteral = function(L, b, arg) { checkdp(b); /* ensure it uses a dot */ } else { /* integers */ let n = lua.lua_tointeger(L, arg); - let format = (n === llimit.LUA_MININTEGER) /* corner case? */ + let format = (n === luaconf.LUA_MININTEGER) /* corner case? */ ? "0x%" + luaconf.LUA_INTEGER_FRMLEN + "x" /* use hexa */ : luaconf.LUA_INTEGER_FMT; /* else use default format */ concat(b, lua.to_luastring(sprintf(format, n))); @@ -678,7 +677,7 @@ const str_byte = function(L) { if (posi < 1) posi = 1; if (pose > l) pose = l; if (posi > pose) return 0; /* empty interval; return no values */ - if (pose - posi >= llimit.MAX_INT) /* arithmetic overflow? */ + if (pose - posi >= Number.MAX_SAFE_INTEGER) /* arithmetic overflow? */ return lauxlib.luaL_error(L, lua.to_luastring("string slice too long", true)); let n = (pose - posi) + 1; |