|
@ -58,8 +58,10 @@ function Buffer(subject, encoding) { |
|
|
else |
|
|
else |
|
|
throw new TypeError('must start with number, buffer, array or string'); |
|
|
throw new TypeError('must start with number, buffer, array or string'); |
|
|
|
|
|
|
|
|
if (this.length > kMaxLength) |
|
|
if (this.length > kMaxLength) { |
|
|
throw new RangeError('length > kMaxLength'); |
|
|
throw new RangeError('Attempt to allocate Buffer larger than maximum ' + |
|
|
|
|
|
'size: 0x' + kMaxLength.toString(16) + ' bytes'); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
if (this.length < Buffer.poolSize / 2 && this.length > 0) { |
|
|
if (this.length < Buffer.poolSize / 2 && this.length > 0) { |
|
|
if (this.length > poolSize - poolOffset) |
|
|
if (this.length > poolSize - poolOffset) |
|
@ -92,8 +94,10 @@ function Buffer(subject, encoding) { |
|
|
|
|
|
|
|
|
function SlowBuffer(length) { |
|
|
function SlowBuffer(length) { |
|
|
length = length >>> 0; |
|
|
length = length >>> 0; |
|
|
if (length > kMaxLength) |
|
|
if (this.length > kMaxLength) { |
|
|
throw new RangeError('length > kMaxLength'); |
|
|
throw new RangeError('Attempt to allocate Buffer larger than maximum ' + |
|
|
|
|
|
'size: 0x' + kMaxLength.toString(16) + ' bytes'); |
|
|
|
|
|
} |
|
|
var b = new NativeBuffer(length); |
|
|
var b = new NativeBuffer(length); |
|
|
alloc(b, length); |
|
|
alloc(b, length); |
|
|
return b; |
|
|
return b; |
|
|