Commit Graph

21 Commits (4b5e6a38df2f68fd407ccfbdcb70960f6af6e0e2)

Author SHA1 Message Date
Ben Noordhuis 96a314b68b buffer: strip high bits when converting to ascii
Consider the following example:

  console.log(Buffer('ú').toString('ascii'));

Before this commit, the contents of the buffer was used as-is and hence it
prints 'ú'.

Now, it prints 'C:'. Perhaps not much of an improvement but it conforms to what
the documentation says it does: strip off the high bits.

Fixes #4371.
2013-03-08 14:42:15 -08:00
Ben Noordhuis 3f7e88a852 buffer: accept negative indices in Buffer#slice()
A negative start or end parameter now indexes from the end of the
buffer. More in line with String#slice() and ArrayBuffer#slice().
2013-02-12 17:09:19 -08:00
Ben Noordhuis 30b0bc4fa9 doc: update buffer/typed array documentation
Clarify that typed array constructors accept buffers as their first
argument but that the memory is not shared and why this was changed
in v0.9.
2013-02-10 21:57:32 +01:00
Trevor Norris 49175e6ae2 buffer: clean up copy() asserts and tests
Argument checks were simplified by setting all undefined/NaN or out of
bounds values equal to their defaults.

Also copy() tests had a flaw that each buffer had the same bit pattern at
the same offset. So even if the copy failed, the bit-by-bit comparison
would have still been true. This was fixed by filling each buffer with a
unique value before copy operations.
2013-01-25 11:59:21 +01:00
Trevor Norris 3d286b68be buffer: remove float write range checks
Removed range checks when writing float values, and removed a few
includes and defines. Also updated api docs to reflect that invalid 32
bit float is an unspecified behavior.
2013-01-23 13:55:04 +01:00
isaacs 77ed12fe7a Merge remote-tracking branch 'ry/v0.8' into master
Conflicts:
	AUTHORS
	ChangeLog
	deps/uv/test/test-spawn.c
	deps/uv/uv.gyp
	src/cares_wrap.cc
	src/node.cc
	src/node_version.h
	test/simple/test-buffer.js
	tools/gyp/pylib/gyp/common.py
	tools/install.py
2012-12-13 16:57:58 -08:00
Trevor Norris bb867c0fa6 doc: Add lines about additonal uses of Buffer
That Buffers can be used with Typed Array Views and DataViews. Included
are a couple simple examples.

Closes #4257.
2012-11-22 09:30:18 -08:00
Nathan Rajlich dba47aefa5 docs: fix typo in Buffer#toJSON() docs 2012-09-09 11:15:45 -07:00
Nathan Rajlich a4ef01df07 buffer: implement Buffer.prototype.toJSON()
Returns an Array-representation of the Buffer.
Closes #3905.
2012-09-09 11:04:16 -07:00
isaacs 05282588e0 Buffer.isEncoding(enc)
Re: #3918
2012-08-27 13:01:29 -07:00
isaacs d53cdc5378 Add Buffer.concat method
We write out this loop a lot of places throughout node.
It clearly needs to be an API method.
2012-06-11 15:51:23 -07:00
Jeroen Janssen 1fc2c3823c doc: updated JavaScript casing where relevant
Fixes #3326.
2012-05-26 19:34:13 +09:00
isaacs a3753b496e Revert "Fix #3242 Actually deprecate 'binary' buffer encoding"
This reverts commit 5979f096d1.

Related:
- #3279
- #3278
2012-05-16 16:32:37 -07:00
isaacs 5164ae3838 Merge remote-tracking branch 'ry/v0.6' into v0.6-merge
Conflicts:
	ChangeLog
	deps/uv/include/uv-private/uv-unix.h
	deps/uv/src/unix/core.c
	deps/uv/src/unix/sunos.c
	deps/v8/src/runtime.cc
	doc/api/crypto.markdown
	lib/http.js
	src/node_version.h
	test/gc/test-http-client-timeout.js
	wscript
2012-05-15 11:37:34 -07:00
Shigeki Ohtsu cc8cfb145a doc: fix typo in buffer documentation
Fixes #3253.
2012-05-11 20:00:53 +09:00
isaacs 5979f096d1 Fix #3242 Actually deprecate 'binary' buffer encoding 2012-05-09 10:08:54 -07:00
koichik ebbd4039bc buffer: add UTF-16LE encoding name. 2012-05-03 23:56:17 +09:00
Kyle Robinson Young c9e6d3696c doc: typo fixes 2012-05-01 02:25:08 +02:00
Yoshihiro Kikuchi c450ac343f docs: fix using legacy api in the buffer doc 2012-03-12 15:04:53 +01:00
isaacs 674416fbc9 s/buffers/buffer/ 2012-02-29 16:04:55 -08:00
isaacs f9e464f95a s/buffers/buffer/ 2012-02-27 11:14:38 -08:00