Silence MuPDF warnings/errors unconditionally (fixes #132) - #148
Closed
tloriato wants to merge 2 commits into
Closed
Silence MuPDF warnings/errors unconditionally (fixes #132)#148tloriato wants to merge 2 commits into
tloriato wants to merge 2 commits into
Conversation
Owner
|
Sorry, do not have much time to spend on this. At first glance, why would a user be involved at all? Warnings should be silenced; who wants them in the output? Errors should be returned as errors. How useful would be for someone to log and collect warnings. As for purego and NewCallback, just a note that there is a limited number of callbacks one can create so it should be reused if possible. |
Remove the opt-in Quiet flag — stderr callbacks are now always suppressed. Errors continue to surface via Go error returns. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Author
|
Hey @gen2brain! Thank you for looking, I tried to change and make as brief as possible so it doesn't take your time. What I reworked:
Net result is -35 / +9 lines vs the previous revision. All 35 tests pass. |
Owner
|
Warnings are silenced in d009362 . Closing this one. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Unconditionally silences MuPDF warning and error callbacks on every new context, suppressing stderr noise like
warning: ignoring CMap range .... Errors are still surfaced via Goerrorreturns.Closes #132.
Changes
fitz_cgo.go): static no-op callback +go_fitz_silence(ctx)called inNewandNewFromMemory.fitz_nocgo.go): singlepurego.NewCallbackallocated ininit(), reused for every context viaapplySilence.go build ./...,go vet ./...clean.