Subj : JS_ValueToECMAUint32 documentation wrong To : netscape.public.mozilla.jseng From : Christian Biesinger Date : Sat Jan 08 2005 03:02 pm This is a multi-part message in MIME format. --------------010603060802020309070201 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Hi, I noticed two problems in the documentation for JS_ValueToECMAUint32, at http://www.mozilla.org/js/spidermonkey/apidoc/gen/api-JS_ValueToECMAUint32.html: - it mentions " JS_ValueToECMAUint32 converts a JS value, v, to a JS double, and then to an ECMA-standard, 32-bit, signed integer." -- surely it converts to an _unsigned_ integer, hence the Uint in the function name and signature? - "If the conversion is successful, JS_ValueToECMAInt32 returns JS_TRUE". This should say JS_ValueToECMAUint32, not JS_ValueToECMAInt32. I attached a patch that makes those changes to jsref.xml; I don't know what the review rules for this file are... -biesi --------------010603060802020309070201 Content-Type: text/plain; name="jsdocs" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="jsdocs" Index: jsref.xml =================================================================== RCS file: /cvsroot/mozilla/js/docs/jsref.xml,v retrieving revision 1.7 diff -p -u -6 -r1.7 jsref.xml --- jsref.xml 15 Apr 2004 16:20:34 -0000 1.7 +++ jsref.xml 8 Jan 2005 13:59:08 -0000 @@ -1900,15 +1900,16 @@ JSBool JS_ValueToECMAUint32(JSContext *c Pointer to the JS value that contains the converted integer when the function returns.
- JS_ValueToECMAUint32 converts a JS value, v, to a JS double, and then to an ECMA-standard, 32-bit, signed integer. The fractional portion of the double is dropped silently during conversion to an integer value. If the double is out of range, the result is computed modulo 2**32.

+ JS_ValueToECMAUint32 converts a JS value, v, to a JS double, + and then to an ECMA-standard, 32-bit, unsigned integer. The fractional portion of the double is dropped silently during conversion to an integer value. If the double is out of range, the result is computed modulo 2**32.

You can convert a JS value to an integer if the JS value to convert is a JSVAL_INT, JSVAL_DOUBLE, or JSVAL_BOOLEAN. If the JS value is a JSVAL_STRING that contains a well formed numeric literal (ignoring leading and trailing whitespace) conversion also succeeds. If the JS value is a JSVAL_OBJECT, conversion is successful if the object's convert operation returns a primitive value that can be converted.

- If the conversion is successful, JS_ValueToECMAInt32 returns JS_TRUE, and ip contains a pointer to the converted value. Otherwise, it reports an error and returns JS_FALSE.

+ If the conversion is successful, JS_ValueToECMAUint32 returns JS_TRUE, and ip contains a pointer to the converted value. Otherwise, it reports an error and returns JS_FALSE.

--------------010603060802020309070201-- .