Skip to content
Snippets Groups Projects
Commit 49eef9c4 authored by rswindell's avatar rswindell
Browse files

console.getkeys() had a couple of bugs:

- you couldn't specify a maxnum value of 0 (it would get overridden to ~0)
- you couldn't specify a mode argument value without also specifying a non-zero
  maxnum value
parent 488f8396
No related branches found
No related tags found
No related merge requests found
......@@ -700,7 +700,8 @@ js_getkeys(JSContext *cx, uintN argc, jsval *arglist)
char key[2];
uintN i;
int32 val;
uint32 maxnum = 0;
uint32 maxnum = ~0;
bool maxnum_specified = false;
long mode = K_UPPER;
sbbs_t* sbbs;
JSString* js_str=NULL;
......@@ -716,9 +717,10 @@ js_getkeys(JSContext *cx, uintN argc, jsval *arglist)
if(JSVAL_IS_NUMBER(argv[i])) {
if(!JS_ValueToInt32(cx, argv[i], &val))
return JS_FALSE;
if(maxnum == 0)
if(!maxnum_specified) {
maxnum_specified = true;
maxnum = val;
else
} else
mode = val;
continue;
}
......@@ -730,9 +732,6 @@ js_getkeys(JSContext *cx, uintN argc, jsval *arglist)
}
}
if(maxnum == 0)
maxnum = ~0;
rc=JS_SUSPENDREQUEST(cx);
val=sbbs->getkeys(cstr, maxnum, mode);
FREE_AND_NULL(cstr);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment