-
Notifications
You must be signed in to change notification settings - Fork 10.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve the handling of Encoding
dictionary, with Differences
array, in PartialEvaluator_preEvaluateFont
#7920
Improve the handling of Encoding
dictionary, with Differences
array, in PartialEvaluator_preEvaluateFont
#7920
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Look good. Thanks
diffBuf[j] = diffEntry.toString(); | ||
} | ||
} | ||
hash.update(diffBuf.join('')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change separator argument, e.g. use default or '\n' -- just to have "length" as a part of the hash.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've changed it to the default instead; thanks for reviewing!
…ay, in `PartialEvaluator_preEvaluateFont` I recently happened to look at the code I wrote for PR 5964, which fixed [bug 1157493](https://bugzilla.mozilla.org/show_bug.cgi?id=1157493), and I quickly realized that the solution is way too simplistic. The fact that only using the `length` of a `Differences` array worked seems more like a happy accident for a particular set of font data, but could just as easily be incorrect for other PDF files. Note that in practice, the case where the `Encoding` entry is a regular `Dict` (and not a `Ref` or `Name`) is very rare, hence I don't think that we really need to worry about having to reparse this data. Also, the performance of this code-block is quite a bit better by updating the `hash` with the data from the *entire* `Differences` array, instead of at every loop iteration.
From: Bot.io (Linux)ReceivedCommand cmd_test from @Snuffleupagus received. Current queue size: 0 Live output at: http://107.21.233.14:8877/9059fe585751588/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_test from @Snuffleupagus received. Current queue size: 0 Live output at: http://107.22.172.223:8877/07f4e43b645ace6/output.txt |
From: Bot.io (Windows)SuccessFull output at http://107.22.172.223:8877/07f4e43b645ace6/output.txt Total script time: 25.94 mins
|
From: Bot.io (Linux)SuccessFull output at http://107.21.233.14:8877/9059fe585751588/output.txt Total script time: 26.43 mins
|
Improve the handling of `Encoding` dictionary, with `Differences` array, in `PartialEvaluator_preEvaluateFont`
I recently happened to look at the code I wrote for PR #5964, which fixed bug 1157493, and I quickly realized that the solution is way too simplistic.
The fact that only using the
length
of aDifferences
array worked seems more like a happy accident for a particular set of font data, but could just as easily be incorrect for other PDF files.Note that in practice, the case where the
Encoding
entry is a regularDict
(and not aRef
orName
) is very rare, hence I don't think that we really need to worry about having to reparse this data.Also, the performance of this code-block is quite a bit better by updating the
hash
with the data from the entireDifferences
array, instead of at every loop iteration.