Skip to content

Commit f310c0f

Browse files
committed
Merge remote-tracking branch 'origin/v0.10' into master
Conflicts: doc/api/buffer.markdown lib/_stream_readable.js lib/assert.js lib/buffer.js lib/child_process.js lib/http.js lib/string_decoder.js lib/zlib.js node.gyp test/simple/test-buffer.js test/simple/test-https-foafssl.js test/simple/test-stream2-compatibility.js test/simple/test-tls-server-verify.js
2 parents ef3c4ed + 38f6fcd commit f310c0f

16 files changed

+114
-41
lines changed

configure

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,8 @@ def configure_node(o):
473473

474474
if target_arch != host_arch and not options.without_snapshot:
475475
o['variables']['want_separate_host_toolset'] = 1
476+
else:
477+
o['variables']['want_separate_host_toolset'] = 0
476478

477479
if target_arch == 'arm':
478480
configure_arm(o)

doc/api/buffer.markdown

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,22 @@ encoding method. Here are the different string encodings.
3737

3838
* `'hex'` - Encode each byte as two hexadecimal characters.
3939

40+
Creating a typed array from a `Buffer` works with the following caveats:
41+
42+
1. The buffer's memory is copied, not shared.
43+
44+
2. The buffer's memory is interpreted as an array, not a byte array. That is,
45+
`new Uint32Array(new Buffer([1,2,3,4]))` creates a 4-element `Uint32Array`
46+
with elements `[1,2,3,4]`, not an `Uint32Array` with a single element
47+
`[0x1020304]` or `[0x4030201]`.
48+
49+
NOTE: Node.js v0.8 simply retained a reference to the buffer in `array.buffer`
50+
instead of cloning it.
51+
52+
While more efficient, it introduces subtle incompatibilities with the typed
53+
arrays specification. `ArrayBuffer#slice()` makes a copy of the slice while
54+
`Buffer#slice()` creates a view.
55+
4056
## Class: Buffer
4157

4258
The Buffer class is a global type for dealing with binary data directly.

doc/api/console.markdown

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,15 @@ Finish timer, record output. Example:
7474
}
7575
console.timeEnd('100-elements');
7676

77-
## console.trace(label)
77+
## console.trace(message, [...])
7878

79-
Print a stack trace to stderr of the current position.
79+
Print to stderr `'Trace :'`, followed by the formatted message and stack trace
80+
to the current position.
8081

81-
## console.assert(expression, [message])
82+
## console.assert(value, [message], [...])
8283

83-
Same as [assert.ok()][] where if the `expression` evaluates as `false` throw an
84-
AssertionError with `message`.
84+
Similar to [assert.ok()][], but the error message is formatted as
85+
`util.format(message...)`.
8586

8687
[assert.ok()]: assert.html#assert_assert_value_message_assert_ok_value_message
8788
[util.format()]: util.html#util_util_format_format

doc/api/crypto.markdown

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,8 @@ which must be a `'binary'` encoded string or a [buffer](buffer.html).
188188

189189
It is a [stream](stream.html) that is both readable and writable. The
190190
written data is used to compute the hash. Once the writable side of
191-
the stream is ended, use the `read()` method to get the computed hash
192-
digest. The legacy `update` and `digest` methods are also supported.
191+
the stream is ended, use the `read()` method to get the enciphered
192+
contents. The legacy `update` and `final` methods are also supported.
193193

194194
## crypto.createCipheriv(algorithm, key, iv)
195195

doc/api/modules.markdown

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,8 @@ in pseudocode of what require.resolve does:
385385
LOAD_AS_FILE(X)
386386
1. If X is a file, load X as JavaScript text. STOP
387387
2. If X.js is a file, load X.js as JavaScript text. STOP
388-
3. If X.node is a file, load X.node as binary addon. STOP
388+
3. If X.json is a file, parse X.json to a JavaScript Object. STOP
389+
4. If X.node is a file, load X.node as binary addon. STOP
389390

390391
LOAD_AS_DIRECTORY(X)
391392
1. If X/package.json is a file,

lib/_stream_readable.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,6 @@ function ReadableState(options, stream) {
8585
// if true, a maybeReadMore has been scheduled
8686
this.readingMore = false;
8787

88-
// if true, stream is in old mode
89-
this.oldMode = false;
90-
9188
this.decoder = null;
9289
this.encoding = null;
9390
if (options.encoding) {
@@ -227,7 +224,7 @@ function howMuchToRead(n, state) {
227224
if (state.objectMode)
228225
return n === 0 ? 0 : 1;
229226

230-
if (isNaN(n) || util.isNull(n)) {
227+
if (util.isNull(n) || isNaN(n)) {
231228
// only flow one buffer at a time
232229
if (state.flowing && state.buffer.length)
233230
return state.buffer[0].length;

lib/assert.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ function replacer(key, value) {
6060
if (util.isUndefined(value)) {
6161
return '' + value;
6262
}
63-
if (util.isNumber(value) && (isNaN(value) || !isFinite(value))) {
63+
if (util.isNumber(value) && !isFinite(value)) {
6464
return value.toString();
6565
}
6666
if (util.isFunction(value) || util.isRegExp(value)) {

lib/buffer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ Buffer.prototype.readUInt32BE = function(offset, noAssert) {
505505
return (this[offset] * 0x1000000) +
506506
((this[offset + 1] << 16) |
507507
(this[offset + 2] << 8) |
508-
(this[offset + 3]) >>> 0);
508+
this[offset + 3]);
509509
};
510510

511511

lib/net.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ Socket.prototype.listen = function() {
305305

306306

307307
Socket.prototype.setTimeout = function(msecs, callback) {
308-
if (msecs > 0 && !isNaN(msecs) && isFinite(msecs)) {
308+
if (msecs > 0 && isFinite(msecs)) {
309309
timers.enroll(this, msecs);
310310
timers._unrefActive(this);
311311
if (callback) {

lib/string_decoder.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ StringDecoder.prototype.write = function(buffer) {
8282
while (this.charLength) {
8383
// determine how many remaining bytes this buffer has to offer for this char
8484
var available = (buffer.length >= this.charLength - this.charReceived) ?
85-
this.charLength - this.charReceived :
86-
buffer.length;
85+
this.charLength - this.charReceived :
86+
buffer.length;
8787

8888
// add the new bytes to the char buffer
8989
buffer.copy(this.charBuffer, this.charReceived, 0, available);

0 commit comments

Comments
 (0)