aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-07-17 10:30:14 -0700
committerAlon Zakai <alonzakai@gmail.com>2012-07-17 10:30:14 -0700
commitbeb06f8ff9ac5e7707188a46a81c7f7b1c72f7f0 (patch)
treea970d5dd8b535b2e615d044bc13605b27c6d90a6
parent2a58cf37d8159bb8453fccbaf0b1b5e10fbd676f (diff)
use unget properly in scanString, so it works in fscanf and not just sscanf
-rw-r--r--src/library.js9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/library.js b/src/library.js
index 6e4e7d0e..d1ede6bc 100644
--- a/src/library.js
+++ b/src/library.js
@@ -2288,7 +2288,7 @@ LibraryManager.library = {
if (next == 0) return 0;
if (!(next in __scanString.whiteSpace)) break;
}
- unget();
+ unget(next);
next = 1;
for (var formatIndex = 0; formatIndex < format.length; formatIndex++) {
if (next <= 0) return fields;
@@ -2328,11 +2328,10 @@ LibraryManager.library = {
}
next = get();
}
+ unget(next);
while (buffer.length > last) {
- buffer.pop();
- unget();
+ unget(buffer.pop().charCodeAt(0));
}
- unget();
next = get();
} else {
var first = true;
@@ -2389,7 +2388,7 @@ LibraryManager.library = {
next = get();
if (next <= 0) return fields; // End of input.
}
- unget();
+ unget(next);
} else {
// Not a specifier.
if (format[formatIndex].charCodeAt(0) !== next) {