mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-25 17:48:07 +02:00
Use Array.join() to build up strings in more places.
This commit is contained in:
parent
cab5d7b96f
commit
ab7568c0ff
3 changed files with 27 additions and 22 deletions
|
@ -291,11 +291,13 @@ var PDFDocument = (function PDFDocumentClosure() {
|
|||
function find(stream, needle, limit, backwards) {
|
||||
var pos = stream.pos;
|
||||
var end = stream.end;
|
||||
var str = '';
|
||||
var strBuf = [];
|
||||
if (pos + limit > end)
|
||||
limit = end - pos;
|
||||
for (var n = 0; n < limit; ++n)
|
||||
str += String.fromCharCode(stream.getByte());
|
||||
for (var n = 0; n < limit; ++n) {
|
||||
strBuf.push(String.fromCharCode(stream.getByte()));
|
||||
}
|
||||
var str = strBuf.join('');
|
||||
stream.pos = pos;
|
||||
var index = backwards ? str.lastIndexOf(needle) : str.indexOf(needle);
|
||||
if (index == -1)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue