Browse Source

Buffer('') should create a 0-length buffer

v0.7.4-release
Peter Griess 15 years ago
committed by Ryan Dahl
parent
commit
b64a521d66
  1. 6
      src/node_buffer.cc

6
src/node_buffer.cc

@ -352,7 +352,7 @@ Handle<Value> Buffer::Utf8Write(const Arguments &args) {
size_t offset = args[1]->Int32Value();
if (offset >= buffer->length_) {
if (s->Utf8Length() > 0 && offset >= buffer->length_) {
return ThrowException(Exception::TypeError(String::New(
"Offset is out of bounds")));
}
@ -390,7 +390,7 @@ Handle<Value> Buffer::AsciiWrite(const Arguments &args) {
size_t offset = args[1]->Int32Value();
if (offset >= buffer->length_) {
if (s->Length() > 0 && offset >= buffer->length_) {
return ThrowException(Exception::TypeError(String::New(
"Offset is out of bounds")));
}
@ -418,7 +418,7 @@ Handle<Value> Buffer::BinaryWrite(const Arguments &args) {
size_t offset = args[1]->Int32Value();
if (offset >= buffer->length_) {
if (s->Length() > 0 && offset >= buffer->length_) {
return ThrowException(Exception::TypeError(String::New(
"Offset is out of bounds")));
}

Loading…
Cancel
Save