summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBenoit Giannangeli <giann008@gmail.com>2017-05-08 13:34:32 +0200
committerBenoit Giannangeli <giann008@gmail.com>2017-05-08 13:34:32 +0200
commit3ba0fe6fd5ad9f62b948bf970347ffef3d5fe4bf (patch)
tree8559ee9bb8cb71824ef5ee35449fb44c7b792e2e /src
parent57a5514f724ee5d31ee6c008954d207da0a6f245 (diff)
downloadfengari-3ba0fe6fd5ad9f62b948bf970347ffef3d5fe4bf.tar.gz
fengari-3ba0fe6fd5ad9f62b948bf970347ffef3d5fe4bf.tar.bz2
fengari-3ba0fe6fd5ad9f62b948bf970347ffef3d5fe4bf.zip
Fix bad integer size for string.pack/packsize
Diffstat (limited to 'src')
-rw-r--r--src/lstrlib.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lstrlib.js b/src/lstrlib.js
index f5b9f34..2eb9ff5 100644
--- a/src/lstrlib.js
+++ b/src/lstrlib.js
@@ -368,7 +368,7 @@ const LUAL_PACKPADBYTE = 0x00;
/* maximum size for the binary representation of an integer */
const MAXINTSIZE = 16;
-const SZINT = 8; // Size of lua_Integer
+const SZINT = 4; // Size of lua_Integer
/* number of bits in a character */
const NB = 8;
@@ -449,7 +449,7 @@ const getoption = function(h, fmt) {
case 'H'.charCodeAt(0): r.size = 2; r.opt = KOption.Kuint; return r;
case 'l'.charCodeAt(0): r.size = 8; r.opt = KOption.Kint; return r; // sizeof(long): 8
case 'L'.charCodeAt(0): r.size = 8; r.opt = KOption.Kuint; return r;
- case 'j'.charCodeAt(0): r.size = 8; r.opt = KOption.Kint; return r; // sizeof(lua_Integer): 8
+ case 'j'.charCodeAt(0): r.size = 4; r.opt = KOption.Kint; return r; // sizeof(lua_Integer): 8
case 'J'.charCodeAt(0): r.size = 8; r.opt = KOption.Kuint; return r;
case 'T'.charCodeAt(0): r.size = 8; r.opt = KOption.Kuint; return r; // sizeof(size_t): 8
case 'f'.charCodeAt(0): r.size = 4; r.opt = KOption.Kfloat; return r; // sizeof(float): 4