shithub: libmujs

Download patch

ref: 7389d25b1a710fbb7a0a28e6e1ab14d05783f41d
parent: 8b6493eecefde0d1a0eda4bdab029c4b4650c68b
author: Tor Andersson <[email protected]>
date: Tue Jan 21 11:36:15 EST 2014

Fix typos.

--- a/jsnumber.c
+++ b/jsnumber.c
@@ -70,7 +70,7 @@
 	js_pushobject(J, J->Number_prototype);
 	{
 		jsB_propf(J, "valueOf", Np_valueOf, 0);
-		jsB_propf(J, "toString", Np_toString, 0);
+		jsB_propf(J, "toString", Np_toString, 1);
 		jsB_propf(J, "toLocaleString", Np_toString, 0);
 		jsB_propf(J, "toFixed", Np_toFixed, 1);
 		jsB_propf(J, "toExponential", Np_toExponential, 1);
--- a/jsrun.c
+++ b/jsrun.c
@@ -251,7 +251,7 @@
 {
 	int i;
 	js_Value tmp = STACK[TOP-1];
-	for (i = 1; i <= n; i++)
+	for (i = 1; i <= n; ++i)
 		STACK[TOP-i] = STACK[TOP-i-1];
 	STACK[TOP-i] = tmp;
 }
@@ -371,7 +371,7 @@
 	saveE = J->E;
 
 	J->E = jsR_newenvironment(J, jsV_newobject(J, JS_COBJECT, NULL), scope);
-	for (i = 0; i < n; i++) {
+	for (i = 0; i < F->numparams; ++i) {
 		js_Property *ref = js_decvar(J, F->params[i]);
 		if (i < n)
 			ref->value = js_tovalue(J, i + 1);
--- a/jsvalue.c
+++ b/jsvalue.c
@@ -294,7 +294,7 @@
 	js_Value vb = js_toprimitive(J, -1, JS_HNUMBER);
 	js_pop(J, 2);
 	if (va.type == JS_TSTRING && vb.type == JS_TSTRING) {
-		return strcmp(va.u.string, va.u.string);
+		return strcmp(va.u.string, vb.u.string);
 	} else {
 		double x = jsV_tonumber(J, &va);
 		double y = jsV_tonumber(J, &vb);