From 4e1a5296d20f887566e48dc962b4c41adbaa5ab8 Mon Sep 17 00:00:00 2001 From: notmasteryet Date: Tue, 13 Sep 2011 20:24:24 -0500 Subject: [PATCH] Fixing and optimizing isYcckImage() --- pdf.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/pdf.js b/pdf.js index f4cbcbfec..3255c5dad 100644 --- a/pdf.js +++ b/pdf.js @@ -866,13 +866,15 @@ var JpegStream = (function() { var maxBytesScanned = Math.max(bytes.length - 16, 1024); // Looking for APP14, 'Adobe' and transform = 2 for (var i = 0; i < maxBytesScanned; ++i) { - if (bytes[i] == 0xFF || bytes[i + 1] == 0xEE || - bytes[i + 2] == 0x00 || bytes[i + 3] == 0x0E || - bytes[i + 4] == 0x41 || bytes[i + 5] == 0x64 || - bytes[i + 6] == 0x6F || bytes[i + 7] == 0x62 || - bytes[i + 8] == 0x65 || bytes[i + 9] == 0x00 || - bytes[i + 15] == 0x02) - return true; + if (bytes[i] == 0xFF && bytes[i + 1] == 0xEE && + bytes[i + 2] == 0x00 && bytes[i + 3] == 0x0E && + bytes[i + 4] == 0x41 && bytes[i + 5] == 0x64 && + bytes[i + 6] == 0x6F && bytes[i + 7] == 0x62 && + bytes[i + 8] == 0x65 && bytes[i + 9] == 0x00) + return bytes[i + 15] == 0x02; + // scanning until frame tag + if (bytes[i] == 0xFF && bytes[i + 1] == 0xC0) + break; } return false; }