Skip to content

Commit 997e71b

Browse files
committed
Merge pull request mozilla#774 from kkujala/master
Fix small jslint issues.
2 parents cd3ab60 + 89a6c4f commit 997e71b

File tree

3 files changed

+17
-19
lines changed

3 files changed

+17
-19
lines changed

src/core.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,6 @@ var Page = (function pagePage() {
161161
var self = this;
162162
this.IRQueue = IRQueue;
163163
var gfx = new CanvasGraphics(this.ctx, this.objs);
164-
var startTime = Date.now();
165164

166165
var displayContinuation = function pageDisplayContinuation() {
167166
// Always defer call to display() to work around bug in
@@ -242,7 +241,6 @@ var Page = (function pagePage() {
242241
var IRQueue = this.IRQueue;
243242

244243
var self = this;
245-
var startTime = Date.now();
246244
function next() {
247245
startIdx = gfx.executeIRQueue(IRQueue, startIdx, next);
248246
if (startIdx == length) {

src/crypto.js

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ var ARCFourCipher = (function arcFourCipher() {
2626
var a = this.a, b = this.b, s = this.s;
2727
var output = new Uint8Array(n);
2828
for (i = 0; i < n; ++i) {
29-
var tmp;
3029
a = (a + 1) & 0xFF;
3130
tmp = s[a];
3231
b = (b + tmp) & 0xFF;
@@ -75,8 +74,8 @@ var calculateMD5 = (function calculateMD5() {
7574
padded[i] = data[offset++];
7675
padded[i++] = 0x80;
7776
n = paddedLength - 8;
78-
for (; i < n; ++i)
79-
padded[i] = 0;
77+
while (i < n)
78+
padded[i++] = 0;
8079
padded[i++] = (length << 3) & 0xFF;
8180
padded[i++] = (length >> 5) & 0xFF;
8281
padded[i++] = (length >> 13) & 0xFF;
@@ -322,12 +321,12 @@ var AES128Cipher = (function aes128Cipher() {
322321
state[10] = state[2]; state[6] = t; state[2] = u;
323322
t = state[15]; u = state[11]; v = state[7]; state[15] = state[3];
324323
state[11] = t; state[7] = u; state[3] = v;
325-
// InvSubBytes
326-
for (j = 0; j < 16; ++j)
324+
for (j = 0; j < 16; ++j) {
325+
// InvSubBytes
327326
state[j] = inv_s[state[j]];
328-
// AddRoundKey
329-
for (j = 0; j < 16; ++j)
327+
// AddRoundKey
330328
state[j] ^= key[j];
329+
}
331330
return state;
332331
}
333332

@@ -471,11 +470,11 @@ var CipherTransformFactory = (function cipherTransformFactory() {
471470
cipher = new ARCFourCipher(encryptionKey);
472471
var checkData = cipher.encryptBlock(calculateMD5(hashData, 0, i));
473472
n = encryptionKey.length;
474-
var derrivedKey = new Uint8Array(n), k;
473+
var derivedKey = new Uint8Array(n), k;
475474
for (j = 1; j <= 19; ++j) {
476475
for (k = 0; k < n; ++k)
477-
derrivedKey[k] = encryptionKey[k] ^ j;
478-
cipher = new ARCFourCipher(derrivedKey);
476+
derivedKey[k] = encryptionKey[k] ^ j;
477+
cipher = new ARCFourCipher(derivedKey);
479478
checkData = cipher.encryptBlock(checkData);
480479
}
481480
} else {

src/evaluator.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -145,12 +145,12 @@ var PartialEvaluator = (function partialEvaluator() {
145145
var font = xref.fetchIfRef(fontRef);
146146
assertWellFormed(isDict(font));
147147
if (!font.translated) {
148-
font.translated = self.translateFont(font, xref, resources, handler,
149-
uniquePrefix, dependency);
148+
font.translated = self.translateFont(font, xref, resources,
149+
dependency);
150150
if (font.translated) {
151151
// keep track of each font we translated so the caller can
152152
// load them asynchronously before calling display on a page
153-
loadedName = 'font_' + uniquePrefix + ++self.objIdCounter;
153+
loadedName = 'font_' + uniquePrefix + (++self.objIdCounter);
154154
font.translated.properties.loadedName = loadedName;
155155
font.loadedName = loadedName;
156156

@@ -180,7 +180,7 @@ var PartialEvaluator = (function partialEvaluator() {
180180
var h = dict.get('Height', 'H');
181181

182182
if (image instanceof JpegStream) {
183-
var objId = 'img_' + uniquePrefix + ++self.objIdCounter;
183+
var objId = 'img_' + uniquePrefix + (++self.objIdCounter);
184184
handler.send('obj', [objId, 'JpegStream', image.getIR()]);
185185

186186
// Add the dependency on the image object.
@@ -470,7 +470,7 @@ var PartialEvaluator = (function partialEvaluator() {
470470
var glyphsWidths = {};
471471
var widths = xref.fetchIfRef(dict.get('W'));
472472
if (widths) {
473-
var start = 0, end = 0;
473+
var start = 0;
474474
for (var i = 0, ii = widths.length; i < ii; i++) {
475475
var code = widths[i];
476476
if (isArray(code)) {
@@ -710,7 +710,8 @@ var PartialEvaluator = (function partialEvaluator() {
710710
// special case for symbols
711711
var encoding = Encodings.symbolsEncoding.slice();
712712
for (var i = 0, n = encoding.length, j; i < n; i++) {
713-
if (!(j = encoding[i]))
713+
j = encoding[i];
714+
if (!j)
714715
continue;
715716
map[i] = GlyphsUnicode[j] || 0;
716717
}
@@ -731,7 +732,7 @@ var PartialEvaluator = (function partialEvaluator() {
731732
},
732733

733734
translateFont: function partialEvaluatorTranslateFont(dict, xref, resources,
734-
queue, handler, uniquePrefix, dependency) {
735+
dependency) {
735736
var baseDict = dict;
736737
var type = dict.get('Subtype');
737738
assertWellFormed(isName(type), 'invalid font Subtype');

0 commit comments

Comments
 (0)