aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormax99x <max99x@gmail.com>2011-07-28 13:37:31 +0300
committermax99x <max99x@gmail.com>2011-07-28 13:49:06 +0300
commit0f1a5466b1ec2f8ad74fbaf422be7e2ad1e7a7d6 (patch)
treed0df738a3c32df3acd0aa180f19d15c480e83765
parent29db6fb65a4199607b532bae5e0114c0150c5cdc (diff)
Removed invalid null parameter from atexit callbacks;
Truncating unicode in intArray(To|From)String.
-rw-r--r--src/preamble.js24
1 files changed, 19 insertions, 5 deletions
diff --git a/src/preamble.js b/src/preamble.js
index e60377e6..95bde991 100644
--- a/src/preamble.js
+++ b/src/preamble.js
@@ -483,7 +483,7 @@ function __shutdownRuntime__() {
if (typeof func === 'number') {
func = FUNCTION_TABLE[func];
}
- func(atexit.arg || null);
+ func(atexit.arg);
}
// allow browser to GC, set heaps to null?
@@ -568,7 +568,14 @@ function intArrayFromString(stringy, dontAddNull) {
var t;
var i = 0;
while (i < stringy.length) {
- ret.push(stringy.charCodeAt(i));
+ var chr = stringy.charCodeAt(i);
+ if (chr > 0xFF) {
+#if ASSERTIONS
+ assert(false, 'String character code not inside 0 - 0xFF.');
+#endif
+ chr &= 0xFF;
+ }
+ ret.push(chr);
i = i + 1;
}
if (!dontAddNull) {
@@ -579,11 +586,18 @@ function intArrayFromString(stringy, dontAddNull) {
Module['intArrayFromString'] = intArrayFromString;
function intArrayToString(array) {
- var ret = '';
+ var ret = [];
for (var i = 0; i < array.length; i++) {
- ret += String.fromCharCode(array[i]);
+ var chr = array[i];
+ if (chr > 0xFF) {
+#if ASSERTIONS
+ assert(false, 'String character code not inside 0 - 0xFF.');
+#endif
+ chr &= 0xFF;
+ }
+ ret.push(String.fromCharCode(chr));
}
- return ret;
+ return ret.join('');
}
{{{ unSign }}}