Attempt to remove usage of `makeSubStream` in src/core/type1_parser.js
See original GitHub issueI was recently sorting through and throwing out old notes, when I found this and figured it wouldn’t hurt to at least submit an issue.
In Type1Parser
, there’s currently two usages of makeSubStream
that seem completely unnecessary; see https://github.com/mozilla/pdf.js/blob/7ba50448fdef660d22b799b5814af36ad63407c4/src/core/type1_parser.js#L562-L566 and https://github.com/mozilla/pdf.js/blob/7ba50448fdef660d22b799b5814af36ad63407c4/src/core/type1_parser.js#L585-L589
Using makeSubStream
in that fashion makes the code look more convoluted than necessary, and should also be less efficient since it causes a new Stream
to be initialized when all that’s really needed here is to get a known number of bytes from the already available stream.
At least in theory, although testing is obviously required, it should be possible to replace each of those blocks with the following code instead
lenIV = program.properties.privateData['lenIV'];
encoded = this.readCharStrings(stream.getBytes(length), lenIV);
Since this issue could potentially be a candidate for the 5-good-beginner-bug
label, I’m including a link to https://github.com/mozilla/pdf.js/wiki/Contributing for good measure. Especially the sections “Generating reference images” and “Run testing” is of particular importance, for anyone wanting to work on this.
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (5 by maintainers)
Top GitHub Comments
It requires #9696 to be fixed first. I’d say for now you can ignore those files because our test bot has them and we’ll trigger the test bot for a pull request anyway.
The pull request itself looks good, but we are having some problems with our testing infrastructure that prevent us from merging it. After that’s done, this issue will be closed automatically.