Commit Graph

70 Commits

Author SHA1 Message Date
Ryan Dahl
dcc4fffe4d Add C++ API for constructing fast buffer from string 2010-10-26 13:43:58 -07:00
Stéphan Kochen
dd52737476 Provide a C++ Buffer constructor for external storage.
In order to do this, buffer data management was moved out of the
JS entry-point New, and into Replace.

Secondly, the constructor makes an immediate call to Replace, and
in order for ArrayData calls to work, wrapping must already be set
up. Now, the constructor takes the wrappee as a parameter.
2010-10-22 16:52:14 -07:00
Stéphan Kochen
b3e60c7b25 Generalize Buffer::Copy to work with all unsigned byte external data. 2010-10-22 13:47:10 -07:00
Stéphan Kochen
d5e966154c Simplify things by using *ArrayData everywhere. 2010-10-22 13:32:48 -07:00
Stéphan Kochen
d9b08d66d6 Remove old interface remains from Buffer.
These were all lacking implementation, so deprecating wouldn't help.
2010-10-22 13:32:31 -07:00
Jorge Chamorro Bieling
c735b4663a unbase64 skips over *any* illegal chars 2010-10-18 15:22:10 -07:00
Ryan Dahl
cf1db4f304 base64 decode should handle whitespace 2010-10-18 11:34:35 -07:00
Ryan Dahl
9d248f690a Fix return in Buffer::New 2010-10-10 19:24:33 -07:00
Ryan Dahl
0cf03ab800 Add char* constructor for Buffer 2010-10-10 19:08:51 -07:00
Ryan Dahl
fe74283e1d Fix a few compiler warnings... 2010-10-09 16:04:38 -07:00
Ryan Dahl
b5359e40be Warnings for new C++ buffer API 2010-10-09 12:15:16 -07:00
Ben Noordhuis
55c65cc2d5 Safe constructor for ObjectWrapped classes
New() methods should be invoked as constructors, not regular functions.
Corner cases like Script::New() may cause a SIGSEGV when the GC is run.

More details: http://groups.google.com/group/nodejs/browse_thread/thread/a7e5db68d4cd6356
2010-09-29 16:02:45 -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
380d12832c Remove dead code 2010-09-09 11:03:50 -07:00
Ryan Dahl
efc723787a Fix big string bug 2010-09-09 11:03:50 -07:00
Ryan Dahl
71d67dbf48 Remove fancy SlowBuffer constructor 2010-09-09 11:03:50 -07:00
Ryan Dahl
6135941eea Fix ByteLength hangup 2010-09-09 11:03:50 -07:00
Ryan Dahl
ececd92f62 Fix base64 write for buffers 2010-09-09 11:03:49 -07:00
Ryan Dahl
1f947f7b41 remove unnecessary casts 2010-09-09 11:03:49 -07:00
Ryan Dahl
7b772f3f68 More fast buffer work 2010-09-09 11:03:48 -07:00
Ryan Dahl
d5bdda74c1 fast buffer bounds checking in copy() 2010-09-09 11:03:48 -07:00
Ryan Dahl
1cf538a60a Work to get C++ fast buffers. incomplete 2010-09-09 11:03:48 -07:00
Ryan Dahl
565d862f3c Fix buffer binding 2010-09-09 11:03:48 -07:00
Tim-Smart
746d487da8 FastBuffer implementation. API needs migration 2010-09-09 11:03:47 -07:00
Ryan Dahl
f86ad1693f Safe Constructor: Buffer 2010-08-27 15:23:51 -07:00
Ryan Dahl
488aff085b Improve appendix markdown 2010-08-21 01:24:14 -07:00
Ryan Dahl
7db5c8a10d Fix toString('base64') bug
Thanks to Stepan Stolyarov for the test case.
2010-08-04 11:38:48 -07:00
Ryan Dahl
c38dd24dc5 Fix style 2010-07-30 10:54:43 -07:00
Ben Noordhuis
f72ac17c89 Buffer: graciously handle padding in base64-encoded input. 2010-07-30 10:49:00 -07:00
Ryan Dahl
f291fbc8a7 Fix ending \0 in base64 decoding 2010-07-29 14:52:40 -07:00
Ben Noordhuis
95638c9b0d Buffer: adjust buffer size so the base64-decoded input fits snugly.
Stops Valgrind from complaining about uninitialized memory access.
2010-07-28 11:37:23 -07:00
Benjamin Kramer
eeaf1ef970 Constify read-only global data
Also silences a compiler warning about deprecated conversion from const
char* to char*.
2010-07-26 22:14:39 +02:00
Ryan Dahl
2c1ca4078d Implement buffer.write for base64
There might be an off-by-one on the returned value.
2010-07-23 16:36:52 -07:00
Ryan Dahl
528015e0d8 Implement buffer.toString('base64') 2010-07-23 13:52:44 -07:00
Peter Griess
e7c4f8cdaa Buffer.copy() should liberally allow empty copies. 2010-07-15 10:20:42 -07:00
Peter Griess
b64a521d66 Buffer('') should create a 0-length buffer 2010-07-15 09:54:53 -07:00
Paul Querna
82daa46e26 Move Buffer to extension model. 2010-07-14 10:37:24 -07:00
Blake Mizerany
8c8534046c fix whitespace errors 2010-06-29 23:59:24 -07:00
Matt Ranney
02ed0ec93b On overlapping buffers use memmove 2010-06-29 21:06:00 -07:00
Ryan Dahl
5e86d01385 Revert "Buffer.copy should copy through sourceEnd, as specified."
This reverts commit a2f70da4c9.

Keep tests modifies a few edge checks on Copy()
2010-06-29 19:40:20 -07:00
Matt Ranney
a2f70da4c9 Buffer.copy should copy through sourceEnd, as specified.
Improve test-buffer.js to cover all copy error cases.

Fix off by one error in string_decoder.
2010-06-25 09:10:49 -07:00
Ryan Dahl
3768aaaea4 Create a public Buffer constructor for use in addons. 2010-05-24 13:26:18 -07:00
Felix Geisendörfer
0a539865dd Support arrays and strings in buffer constructor
This is be very useful for testing code that deals with buffers.
2010-05-17 11:19:14 -07:00
Ryan Dahl
8e5b91c79b Revert "Check for strings.h"
This reverts commit 032f651824.
2010-05-10 16:38:14 -07:00
Ryan Dahl
032f651824 Check for strings.h 2010-05-10 16:30:31 -07:00
kriskowal
8d1f1186ca Fixed/Completed buffer copy range checks. 2010-04-30 17:36:21 -07:00
Ryan Dahl
5281f29012 Use new method of getting chars written for UTF8 2010-04-15 02:09:51 -07:00
Ryan Dahl
41ef1717e0 Upgrade V8 to 2.2.3.1 2010-04-14 10:34:27 -07:00
Ryan Dahl
b8c0349750 Fix triple buffer slice bug 2010-04-14 00:36:34 -07:00