aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/library.js1
-rwxr-xr-xtests/runner.py8
2 files changed, 7 insertions, 2 deletions
diff --git a/src/library.js b/src/library.js
index 5c2e298e..9eae740a 100644
--- a/src/library.js
+++ b/src/library.js
@@ -2461,6 +2461,7 @@ LibraryManager.library = {
for (var formatIndex = 0; formatIndex < format.length;) {
if (format[formatIndex] === '%' && format[formatIndex+1] == 'n') {
var argPtr = {{{ makeGetValue('varargs', 'argIndex', 'void*') }}};
+ argIndex += Runtime.getNativeFieldSize('void*');
{{{ makeSetValue('argPtr', 0, 'soFar', 'i32') }}};
formatIndex += 2;
continue;
diff --git a/tests/runner.py b/tests/runner.py
index f6784a2d..3967cce7 100755
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -4560,11 +4560,15 @@ Pass: 0.000012 0.000012''')
int x = sscanf("one %n two", "%s %n", word, &l);
printf("%d,%s,%d\n", x, word, l);
-
+ {
+ int a, b, c, count;
+ count = sscanf("12345 6789", "%d %n%d", &a, &b, &c);
+ printf("%i %i %i %i\n", count, a, b, c);
+ }
return 0;
}
'''
- self.do_run(src, '''[DEBUG] word 1: version, l: 7\n1,one,4''')
+ self.do_run(src, '''[DEBUG] word 1: version, l: 7\n1,one,4\n2 12345 6 6789\n''')
def test_sscanf_whitespace(self):
src = r'''