Merge pull request #6411 from Snuffleupagus/remove-Parser_fetchIfRef

Remove `Parser_fetchIfRef` since it's obsolete
This commit is contained in:
Tim van der Meij 2015-09-30 00:38:35 +02:00
commit 1bdfc47de8

View File

@ -341,7 +341,7 @@ var Parser = (function ParserClosure() {
var stream = lexer.stream; var stream = lexer.stream;
// Parse dictionary. // Parse dictionary.
var dict = new Dict(null); var dict = new Dict(this.xref);
while (!isCmd(this.buf1, 'ID') && !isEOF(this.buf1)) { while (!isCmd(this.buf1, 'ID') && !isEOF(this.buf1)) {
if (!isName(this.buf1)) { if (!isName(this.buf1)) {
error('Dictionary key must be a name object'); error('Dictionary key must be a name object');
@ -355,7 +355,7 @@ var Parser = (function ParserClosure() {
} }
// Extract the name of the first (i.e. the current) image filter. // Extract the name of the first (i.e. the current) image filter.
var filter = this.fetchIfRef(dict.get('Filter', 'F')), filterName; var filter = dict.get('Filter', 'F'), filterName;
if (isName(filter)) { if (isName(filter)) {
filterName = filter.name; filterName = filter.name;
} else if (isArray(filter) && isName(filter[0])) { } else if (isArray(filter) && isName(filter[0])) {
@ -416,10 +416,6 @@ var Parser = (function ParserClosure() {
return imageStream; return imageStream;
}, },
fetchIfRef: function Parser_fetchIfRef(obj) {
// not relying on the xref.fetchIfRef -- xref might not be set
return (isRef(obj) ? this.xref.fetch(obj) : obj);
},
makeStream: function Parser_makeStream(dict, cipherTransform) { makeStream: function Parser_makeStream(dict, cipherTransform) {
var lexer = this.lexer; var lexer = this.lexer;
var stream = lexer.stream; var stream = lexer.stream;
@ -429,7 +425,7 @@ var Parser = (function ParserClosure() {
var pos = stream.pos - 1; var pos = stream.pos - 1;
// get length // get length
var length = this.fetchIfRef(dict.get('Length')); var length = dict.get('Length');
if (!isInt(length)) { if (!isInt(length)) {
info('Bad ' + length + ' attribute in stream'); info('Bad ' + length + ' attribute in stream');
length = 0; length = 0;
@ -499,8 +495,8 @@ var Parser = (function ParserClosure() {
return stream; return stream;
}, },
filter: function Parser_filter(stream, dict, length) { filter: function Parser_filter(stream, dict, length) {
var filter = this.fetchIfRef(dict.get('Filter', 'F')); var filter = dict.get('Filter', 'F');
var params = this.fetchIfRef(dict.get('DecodeParms', 'DP')); var params = dict.get('DecodeParms', 'DP');
if (isName(filter)) { if (isName(filter)) {
return this.makeFilter(stream, filter.name, length, params); return this.makeFilter(stream, filter.name, length, params);
} }
@ -532,8 +528,8 @@ var Parser = (function ParserClosure() {
return new NullStream(stream); return new NullStream(stream);
} }
try { try {
if (params) { if (params && this.xref) {
params = this.fetchIfRef(params); params = this.xref.fetchIfRef(params);
} }
var xrefStreamStats = this.xref.stats.streamTypes; var xrefStreamStats = this.xref.stats.streamTypes;
if (name === 'FlateDecode' || name === 'Fl') { if (name === 'FlateDecode' || name === 'Fl') {