Commit Graph

68 Commits (b48f7f7eacb910b060515be9940f459f50fdeb02)

Author SHA1 Message Date
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 1665b4a2a3 lint 2012-05-15 18:04:43 -07:00
Nathan Rajlich 38542f76a9 buffer: make SlowBuffer inherit from Buffer
This frees us from manually having to copy over functions to SlowBuffer's
prototype (which has bitten us multiple times in the past).

As an added bonus, the `inspect()` function is now shared between Buffer
and SlowBuffer, removing some duplicate code.

Closes #3228.
2012-05-11 17:27:40 -07: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
Ben Noordhuis 285d8c6589 buffer: align fast buffers on 8 byte boundary
Prevents alignment issues when people create a typed array from a buffer.
Unaligned loads or stores are less efficent and (on some architectures) unsafe.
2012-03-29 01:31:31 +02:00
Phil Sung cf2513e1aa buffer: don't pollute global namespace in buffer.readInt* 2011-12-22 23:26:43 +01:00
Ben Noordhuis 59a9a9b5b0 buffer: add .read*() and .write*() methods to SlowBuffer prototype
Fixes #2138.
2011-11-18 11:13:37 +01:00
Łukasz Walukiewicz 3b852d7fab buffer: fix minimum values for writeInt*() functions 2011-11-16 21:30:26 +01:00
Ben Noordhuis d157131439 buffers: handle bad length argument in constructor
Coerce fractional, negative and non-numeric length arguments to numbers.
Fractional numbers are rounded up, negative numbers and non-numeric values
are set to zero.
2011-09-24 18:27:03 +02:00
koichik 526c54c979 buffer: write() should always set _charsWritten.
Fixes #1633.
2011-09-08 11:47:32 +09:00
Brian White b7c23ac3f5 Incorporate endianness into buffer.read* function names instead of passing in a boolean flag 2011-08-12 15:49:57 +02:00
Ryan Dahl 2689d262ec Make buffer.INSPECT_MAX_BYTES public for mscdex 2011-08-08 19:04:34 -07:00
Ryan Dahl 7332c4022f Truncate Buffer.inspect at 50 bytes 2011-08-08 17:50:43 -07:00
Robert Mustacchi 0df08c6a0c Endian argument should be a boolean. Signed integers shouldn't run through checks for unsigned integers. Clean up jslint. Provide unchecked uint entry points. 2011-08-08 17:01:57 -07:00
Ryan Dahl 8527f00c3c Lazy load a few modules 2011-07-27 19:54:31 -07:00
koichik 50e147bd03 Add an optional length argument to Buffer.write()
Fixes #243.
Fixes #1361.
2011-07-24 02:01:02 +09:00
Devon Govett 562b469b35 More accurite error messages when writing beyond the length of a Buffer.
Fixes #1336.
2011-07-16 12:56:14 +09:00
Brian White e505a1215c Add reading/writing of floats and doubles from/to buffers
Code for readIEEE754/writeIEEE754 is from jspack: http://code.google.com/p/jspack/
2011-05-15 18:39:07 -07:00
isaacs 205b9beb6b Merge branch 'v0.4'
Conflicts:
	lib/tls.js
	lib/url.js
	src/node_version.h
	test/simple/test-buffer.js
	test/simple/test-url.js
2011-05-07 20:38:32 -07:00
Konstantin Käfer 5e1b7cadb4 Add Buffer::fill method to do memset
Fixes #477.
2011-05-06 13:39:12 -07:00
Robert Mustacchi 9812e31e8b Add reading/writing of C integers to buffers 2011-05-01 14:02:33 -07:00
koichik fcc04e67c8 Fix SlowBuffer.write() with 'ucs2' throws ReferenceError. 2011-04-28 04:57:00 -04:00
Ryan Dahl bfa9db9dd6 Merge branch 'v0.4'
Conflicts:
	src/node_version.h
	test/simple/test-buffer.js
2011-04-03 23:42:56 -07:00
Ryan Dahl 038306a6c3 Closes GH-843. Fix SlowBuffer.prototype.slice 2011-03-29 10:47:14 -07:00
Ryan Dahl 6111c17a0e correct hexSlice end 2011-03-15 11:42:23 -07:00
isaacs 3c9fb3ec1a Fix invalid end handling for SlowBuffer#hexSlice 2011-03-15 11:39:11 -07:00
Ryan Dahl ab190d38b7 Fix buffer.toString('hex') 2011-03-14 18:24:28 -07:00
Ryan Dahl 247d880113 Merge branch 'v0.4'
Conflicts:
	src/node_version.h
2011-03-14 17:45:15 -07:00
Ryan Dahl 55048cdf79 Update copyright headers 2011-03-14 17:37:05 -07:00
isaacs 0aa1a8a005 Closes GH-695 Add 'hex' encoding to Buffer 2011-02-19 19:24:23 -08:00
isaacs 2e6a263e29 Closes GH-609 Support array-ish args to Buffer ctor
Any array-ish thing (whether a Buffer, an Array, or just an object with
a numeric "length") is interpreted as a list of bytes.
2011-02-07 14:13:18 -08:00
Konstantin Käfer 9e101f2b01 UCS-2 support
Closes GH-644.
2011-02-07 13:35:06 -08:00
Ryan Dahl 97e13748fa Typos
Closes GH-557.
Closes GH-539.
2011-01-27 14:28:47 -08:00
Ryan Dahl db78043d52 lint 2010-12-01 16:42:31 -08:00
Ryan Dahl aed0ba3211 buffer.copy targetStart defaults to 0 2010-11-29 19:59:01 -08:00
Ryan Dahl 6d7242b485 Document defaults for buffer.copy() 2010-11-29 19:52:47 -08:00
Ryan Dahl 4f32a59307 Fix buffer.slice(0, 0) 2010-11-23 12:20:22 -08:00
Stéphan Kochen 57eb5cb9a0 Make SlowBuffer pass Buffer.isBuffer test. 2010-11-18 15:36:09 -08:00
Ryan Dahl 515f006b6e Add legacy methods to Buffer 2010-11-02 10:09:59 -07:00
Ryan Dahl cf1db4f304 base64 decode should handle whitespace 2010-10-18 11:34:35 -07:00
Ryan Dahl 77fc61d539 Default value for second arg of Buffer#slice 2010-09-14 15:39:27 -07:00
Ryan Dahl b8bfbdab48 Rename SlowBuffer in binding 2010-09-09 11:03:51 -07:00
Ryan Dahl 5bc4efe820 Remove blobs, simplify SlowBuffer
Implement SlowBuffer.prototype.slice in js
2010-09-09 11:03:51 -07:00
Ryan Dahl ba2e4a2306 Simplify fast buffer constructor 2010-09-09 11:03:50 -07:00
Ryan Dahl 3e9f636b64 Improve long buffer test 2010-09-09 11:03:50 -07:00
Ryan Dahl 17ba821e60 defineProperty is slow, don't use it for fastbuffer 2010-09-09 11:03:50 -07:00
Ryan Dahl d3fcd1c75a Expose SlowBuffer 2010-09-09 11:03:50 -07:00
Ryan Dahl 8b4f1e05f9 Expose Buffer.poolSize 2010-09-09 11:03:50 -07:00
Ryan Dahl 5506f99dfa map charsWritten to fast buffer 2010-09-09 11:03:49 -07:00