|
|
@ -114,7 +114,7 @@ function Buffer (subject, encoding, offset) { |
|
|
|
|
|
|
|
if (this.length > Buffer.poolSize) { |
|
|
|
// Big buffer, just alloc one.
|
|
|
|
this.parent = new SlowBuffer(subject, encoding); |
|
|
|
this.parent = new SlowBuffer(this.length); |
|
|
|
this.offset = 0; |
|
|
|
|
|
|
|
} else { |
|
|
@ -123,21 +123,18 @@ function Buffer (subject, encoding, offset) { |
|
|
|
this.parent = pool; |
|
|
|
this.offset = pool.used; |
|
|
|
pool.used += this.length; |
|
|
|
} |
|
|
|
|
|
|
|
// Do we need to write stuff?
|
|
|
|
if (type !== 'number') { |
|
|
|
// Assume object is an array
|
|
|
|
if (type === 'object') { |
|
|
|
if (Array.isArray(subject)) { |
|
|
|
for (var i = 0; i < this.length; i++) { |
|
|
|
this.parent[i + this.offset] = subject[i]; |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else if (type == 'string') { |
|
|
|
// We are a string
|
|
|
|
this.write(subject, 0, encoding); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
SlowBuffer.makeFastBuffer(this.parent, this, this.offset, this.length); |
|
|
|
} |
|
|
|