Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: lib/typedObjects/stringType.js

Issue 29324295: Noissue - Add missing semicolons (Closed)
Patch Set: Created Aug. 19, 2015, 10:19 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « lib/typedObjects/references.js ('k') | lib/typedObjects/utils.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2015 Eyeo GmbH 3 * Copyright (C) 2006-2015 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 19 matching lines...) Expand all
30 } 30 }
31 }, { 31 }, {
32 constructor: function(value, offset, length) 32 constructor: function(value, offset, length)
33 { 33 {
34 let type = typeof value; 34 let type = typeof value;
35 if (type == "number") 35 if (type == "number")
36 this.length = value | 0; 36 this.length = value | 0;
37 else if (type == "string" || (value && string.isInstance(value))) 37 else if (type == "string" || (value && string.isInstance(value)))
38 { 38 {
39 let sourceLength = value.length | 0; 39 let sourceLength = value.length | 0;
40 offset = Math.min(sourceLength, offset | 0) 40 offset = Math.min(sourceLength, offset | 0);
41 length = (typeof length == "number" ? length | 0 : sourceLength); 41 length = (typeof length == "number" ? length | 0 : sourceLength);
42 length = Math.min(length, sourceLength - offset); 42 length = Math.min(length, sourceLength - offset);
43 this.length = length; 43 this.length = length;
44 44
45 if (length > 0) 45 if (length > 0)
46 { 46 {
47 let dest = new Uint16Array(this.getArrayBuffer(), this.arrayByteOffset, length); 47 let dest = new Uint16Array(this.getArrayBuffer(), this.arrayByteOffset, length);
48 if (type == "string") 48 if (type == "string")
49 { 49 {
50 for (let i = 0; i < length; i++, offset++) 50 for (let i = 0; i < length; i++, offset++)
51 dest[i] = value.charCodeAt(offset); 51 dest[i] = value.charCodeAt(offset);
52 } 52 }
53 else 53 else
54 { 54 {
55 let src = new Uint16Array(value.getArrayBuffer(), 55 let src = new Uint16Array(value.getArrayBuffer(),
56 value.arrayByteOffset + offset * (uint16.referenceLength | 0), 56 value.arrayByteOffset + offset * (uint16.referenceLength | 0),
57 length); 57 length);
58 dest.set(src); 58 dest.set(src);
59 } 59 }
60 } 60 }
61 } 61 }
62 } 62 }
63 }); 63 });
OLDNEW
« no previous file with comments | « lib/typedObjects/references.js ('k') | lib/typedObjects/utils.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld