Commit Graph

4 Commits

Author SHA1 Message Date
Сковорода Никита Андреевич
0ca0827b71 buffer: backport allocUnsafeSlow
This backports the new `Buffer.allocUnsafeSlow()` API for v5.

This backport includes the new API, test cases, and docs additions.
Already present API and testcases were not changed.

PR-URL: https://github.com/nodejs/node/pull/7169
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2016-06-17 18:08:53 +03:00
Rich Trott
c8783aff21 lib,test,tools: alignment on variable assignments
Correct alignment on variable assignments that span multiple lines in
preparation for lint rule to enforce such alignment.

PR-URL: https://github.com/nodejs/node/pull/6242
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-04-20 16:24:21 -07:00
Trevor Norris
d44540f5af buffer: standardize array index check
ParseArrayIndex() was requesting a Uint32Value(), but assigning it to an
in32_t. This caused slight differences in error message reported in edge
cases of argument parsing. Fixed by getting the IntegerValue() before
checking if the value is < 0. Added test of API that was affected.

PR-URL: https://github.com/nodejs/node/pull/6084
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-04-20 16:24:21 -07:00
James M Snell
c1534e7eaf buffer: backport new buffer constructor APIs
This backports the new `Buffer.alloc()`, `Buffer.allocUnsafe()`,
and `Buffer.from()` APIs for v5.

Also included in this backport is the change that allows fill('')
to zero-fill (as opposed to doing nothing) and the additional
`byteOffset` and `length` arguments for `Buffer(arrayBuffer)` and
`Buffer.from(arrayBuffer)`.

This backport includes the new test cases.

This backport *does not* update all of the internal uses of the
existing `Buffer()` constructor.

This backport also *does not* include the soft deprecation of the
existing `Buffer()` constructor.

PR-URL: https://github.com/nodejs/node/pull/5763
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2016-03-24 13:30:25 -07:00