diff options
-rw-r--r-- | AUTHORS | 2 | ||||
-rw-r--r-- | src/library.js | 5 | ||||
-rwxr-xr-x | tests/runner.py | 6 |
3 files changed, 9 insertions, 4 deletions
@@ -71,4 +71,6 @@ a license to everyone to use it as detailed in LICENSE.) * Anthony Pesch <inolen@gmail.com> * Robert Bragg <robert.bragg@intel.com> (copyright owned by Intel Corporation) * Sylvestre Ledru <sylvestre@debian.org> +* Tom Fairfield <fairfield@cs.xu.edu> + 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; diff --git a/tests/runner.py b/tests/runner.py index c14197f4..0aefb8e1 100755 --- a/tests/runner.py +++ b/tests/runner.py @@ -2051,8 +2051,9 @@ Succeeded! char *two = "fa la sa ho fi FI FO FUM WHEN WHERE WHY HOW WHO"; char three[1000]; strcpy(three, &one[argc*2]); - strcat(three, &two[argc*3]); + char *four = strcat(three, &two[argc*3]); printf("cat |%s|\\n", three); + printf("returned |%s|\\n", four); } return 0; @@ -2062,7 +2063,8 @@ Succeeded! print named Settings.NAMED_GLOBALS = named self.do_run(src, '''4:10,177,543,def\n4\nwowie\ntoo\n76\n5\n(null)\n/* a comment */\n// another\ntest\nwaka ....e 1 O...wo 2 T................................ -cat |umber one top notchfi FI FO FUM WHEN WHERE WHY HOW WHO|''', ['wowie', 'too', '74']) +cat |umber one top notchfi FI FO FUM WHEN WHERE WHY HOW WHO| +returned |umber one top notchfi FI FO FUM WHEN WHERE WHY HOW WHO|''', ['wowie', 'too', '74']) if self.emcc_args == []: gen = open(self.in_dir('src.cpp.o.js')).read() assert ('var __str1;' in gen) == named |