Merge pull request #11070 from Snuffleupagus/Parser-getObj-rm-isString
Inline the `isString` check in the `Parser.getObj` method
This commit is contained in:
commit
20181b65d4
@ -19,8 +19,7 @@ import {
|
|||||||
PredictorStream, RunLengthStream
|
PredictorStream, RunLengthStream
|
||||||
} from './stream';
|
} from './stream';
|
||||||
import {
|
import {
|
||||||
assert, bytesToString, FormatError, info, isNum, isSpace, isString,
|
assert, bytesToString, FormatError, info, isNum, isSpace, StreamType, warn
|
||||||
StreamType, warn
|
|
||||||
} from '../shared/util';
|
} from '../shared/util';
|
||||||
import {
|
import {
|
||||||
Cmd, Dict, EOF, isCmd, isDict, isEOF, isName, Name, Ref
|
Cmd, Dict, EOF, isCmd, isDict, isEOF, isName, Name, Ref
|
||||||
@ -90,7 +89,7 @@ class Parser {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getObj(cipherTransform) {
|
getObj(cipherTransform = null) {
|
||||||
const buf1 = this.buf1;
|
const buf1 = this.buf1;
|
||||||
this.shift();
|
this.shift();
|
||||||
|
|
||||||
@ -148,22 +147,20 @@ class Parser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (Number.isInteger(buf1)) { // indirect reference or integer
|
if (Number.isInteger(buf1)) { // indirect reference or integer
|
||||||
const num = buf1;
|
|
||||||
if (Number.isInteger(this.buf1) && isCmd(this.buf2, 'R')) {
|
if (Number.isInteger(this.buf1) && isCmd(this.buf2, 'R')) {
|
||||||
const ref = Ref.get(num, this.buf1);
|
const ref = Ref.get(buf1, this.buf1);
|
||||||
this.shift();
|
this.shift();
|
||||||
this.shift();
|
this.shift();
|
||||||
return ref;
|
return ref;
|
||||||
}
|
}
|
||||||
return num;
|
return buf1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isString(buf1)) { // string
|
if (typeof buf1 === 'string') {
|
||||||
let str = buf1;
|
|
||||||
if (cipherTransform) {
|
if (cipherTransform) {
|
||||||
str = cipherTransform.decryptString(str);
|
return cipherTransform.decryptString(buf1);
|
||||||
}
|
}
|
||||||
return str;
|
return buf1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// simple object
|
// simple object
|
||||||
|
Loading…
x
Reference in New Issue
Block a user