aboutsummaryrefslogtreecommitdiff
path: root/src/library.js
diff options
context:
space:
mode:
authorTom Fairfield <fairfieldt@gameclosure.com>2013-05-02 21:34:20 -0300
committerTom Fairfield <fairfieldt@gameclosure.com>2013-05-02 21:39:32 -0300
commit4bdc1b05e88e5eb51695a3325d07577d8fda46ed (patch)
tree057164a0fe84d4912d6363b9de92847f65f47b7b /src/library.js
parent0fb5e1babc151af00b94c61c3cc5a080d3053d1f (diff)
fixes strcat so that it returns the correct value
It should return the "dest" pointer that was passed in. test_strings has been updated with a test for the correct behavior.
Diffstat (limited to 'src/library.js')
-rw-r--r--src/library.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/library.js b/src/library.js
index 3a966ec8..3983f52b 100644
--- a/src/library.js
+++ b/src/library.js
@@ -4442,9 +4442,10 @@ LibraryManager.library = {
strcat: function(pdest, psrc) {
pdest = pdest|0; psrc = psrc|0;
var i = 0;
- pdest = (pdest + (_strlen(pdest)|0))|0;
+ var pdestEnd = 0;
+ pdestEnd = (pdest + _strlen(pdest))|0;
do {
- {{{ makeCopyValues('pdest+i', 'psrc+i', 1, 'i8', null, 1) }}};
+ {{{ makeCopyValues('pdestEnd+i', 'psrc+i', 1, 'i8', null, 1) }}};
i = (i+1)|0;
} while ({{{ makeGetValueAsm('psrc', 'i-1', 'i8') }}});
return pdest|0;