8000 Remove transparent flipping / always leave proper flipping to the use… · protobufjs/bytebuffer.js@5d089a3 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5d089a3

Browse files
committed
Remove transparent flipping / always leave proper flipping to the user, 4.0.0
1 parent cf838b3 commit 5d089a3

13 files changed

+47
-89
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "bytebuffer",
3-
"version": "4.0.0-pre",
3+
"version": "4.0.0",
44
"author": "Daniel Wirtz <dcode@dcode.io>",
55
"description": "A full-featured ByteBuffer implementation using typed arrays.",
66
"main": "dist/ByteBufferAB.js",

dist/ByteBufferAB.js

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@
124124
* @const
125125
* @expose
126126
*/
127-
ByteBuffer.VERSION = "4.0.0-pre";
127+
ByteBuffer.VERSION = "4.0.0";
128128

129129
/**
130130
* Little endian constant that can be used instead of its boolean value. Evaluates to `true`.
@@ -2881,8 +2881,7 @@
28812881
};
28822882
/**
28832883
* Returns a copy of the backing buffer that contains this ByteBuffer's contents. Contents are the bytes between
2884-
* {@link ByteBuffer#offset} and {@link ByteBuffer#limit}. Will transparently {@link ByteBuffer#flip} this
2885-
* ByteBuffer if `offset > limit` but the actual offsets remain untouched.
2884+
* {@link ByteBuffer#offset} and {@link ByteBuffer#limit}.
28862885
* @param {boolean=} forceCopy If `true` returns a copy, otherwise returns a view referencing the same memory if
28872886
* possible. Defaults to `false`
28882887
* @returns {!ArrayBuffer} Contents as an ArrayBuffer
@@ -2891,11 +2890,6 @@
28912890
ByteBufferPrototype.toBuffer = function(forceCopy) {
28922891
var offset = this.offset,
28932892
limit = this.limit;
2894-
if (offset > limit) {
2895-
var t = offset;
2896-
offset = limit;
2897-
limit = t;
2898-
}
28992893
if (!this.noAssert) {
29002894
if (typeof offset !== 'number' || offset % 1 !== 0)
29012895
throw TypeError("Illegal offset: Not an integer");
@@ -2919,9 +2913,7 @@
29192913

29202914
/**
29212915
* Returns a raw buffer compacted to contain this ByteBuffer's contents. Contents are the bytes between
2922-
* {@link ByteBuffer#offset} and {@link ByteBuffer#limit}. Will transparently {@link ByteBuffer#flip} this
2923-
* ByteBuffer if `offset > limit` but the actual offsets remain untouched. This is an alias of
2924-
* {@link ByteBuffer#toBuffer}.
2916+
* {@link ByteBuffer#offset} and {@link ByteBuffer#limit}. This is an alias of {@link ByteBuffer#toBuffer}.
29252917
* @function
29262918
* @param {boolean=} forceCopy If `true` returns a copy, otherwise returns a view referencing the same memory.
29272919
* Defaults to `false`

dist/ByteBufferAB.min.js

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/ByteBufferAB.min.js.gz

-8 Bytes
Binary file not shown.

dist/ByteBufferAB.min.map

Lines changed: 2 additions & 2 deletions
Large diffs are not rendered by default.

dist/ByteBufferAB_DataView.js

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@
124124
* @const
125125
* @expose
126126
*/
127-
ByteBuffer.VERSION = "4.0.0-pre";
127+
ByteBuffer.VERSION = "4.0.0";
128128

129129
/**
130130
* Little endian constant that can be used instead of its boolean value. Evaluates to `true`.
@@ -2586,8 +2586,7 @@
25862586
};
25872587
/**
25882588
* Returns a copy of the backing buffer that contains this ByteBuffer's contents. Contents are the bytes between
2589-
* {@link ByteBuffer#offset} and {@link ByteBuffer#limit}. Will transparently {@link ByteBuffer#flip} this
2590-
* ByteBuffer if `offset > limit` but the actual offsets remain untouched.
2589+
* {@link ByteBuffer#offset} and {@link ByteBuffer#limit}.
25912590
* @param {boolean=} forceCopy If `true` returns a copy, otherwise returns a view referencing the same memory if
25922591
* possible. Defaults to `false`
25932592
* @returns {!ArrayBuffer} Contents as an ArrayBuffer
@@ -2596,11 +2595,6 @@
25962595
ByteBufferPrototype.toBuffer = function(forceCopy) {
25972596
var offset = this.offset,
25982597
limit = this.limit;
2599-
if (offset > limit) {
2600-
var t = offset;
2601-
offset = limit;
2602-
limit = t;
2603-
}
26042598
if (!this.noAssert) {
26052599
if (typeof offset !== 'number' || offset % 1 !== 0)
26062600
throw TypeError("Illegal offset: Not an integer");
@@ -2624,9 +2618,7 @@
26242618

26252619
/**
26262620
* Returns a raw buffer compacted to contain this ByteBuffer's contents. Contents are the bytes between
2627-
* {@link ByteBuffer#offset} and {@link ByteBuffer#limit}. Will transparently {@link ByteBuffer#flip} this
2628-
* ByteBuffer if `offset > limit` but the actual offsets remain untouched. This is an alias of
2629-
* {@link ByteBuffer#toBuffer}.
2621+
* {@link ByteBuffer#offset} and {@link ByteBuffer#limit}. This is an alias of {@link ByteBuffer#toBuffer}.
26302622
* @function
26312623
* @param {boolean=} forceCopy If `true` returns a copy, otherwise returns a view referencing the same memory.
26322624
* Defaults to `false`

0 commit comments

Comments
 (0)
0