-
Notifications
You must be signed in to change notification settings - Fork 5
fix DecodeConfig in dynamic mode too #10
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,8 +19,7 @@ func decodeDynamic(r io.Reader, configOnly bool) (image.Image, image.Config, err | |
| var data []byte | ||
|
|
||
| if configOnly { | ||
| data = make([]byte, heifMaxHeaderSize) | ||
| _, err = r.Read(data) | ||
| data, err = io.ReadAll(io.LimitReader(r, heifMaxHeaderSize)) | ||
| if err != nil { | ||
| return nil, cfg, fmt.Errorf("read: %w", err) | ||
| } | ||
|
|
@@ -188,6 +187,12 @@ func decodeDynamic(r io.Reader, configOnly bool) (image.Image, image.Config, err | |
| } | ||
|
|
||
| func init() { | ||
| if runtime.GOOS == "windows" { | ||
| dynamic = false | ||
| dynamicErr = fmt.Errorf("dynamic library loading not supported on windows yet; see https://github.com/gen2brain/heic/issues/11") | ||
| return | ||
|
Comment on lines
+190
to
+193
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @gen2brain, I added this for now, until purego is fixed or we work around its limitation in this package's calling wrappers.
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice, thanks. I am merging this. When I find time, I will test everything in the VM. msys2 can probably be used instead of collecting DLLs from different sources. |
||
| } | ||
|
|
||
| var err error | ||
| defer func() { | ||
| if r := recover(); r != nil { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| github.com/ebitengine/purego v0.8.3 h1:K+0AjQp63JEZTEMZiwsI9g0+hAMNohwUOtY0RPGexmc= | ||
| github.com/ebitengine/purego v0.8.3/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= | ||
| github.com/ebitengine/purego v0.9.1 h1:a/k2f2HQU3Pi399RPW1MOaZyhKJL9w/xFpKAg4q1s0A= | ||
| github.com/ebitengine/purego v0.9.1/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= | ||
| github.com/tetratelabs/wazero v1.9.0 h1:IcZ56OuxrtaEz8UYNRHBrUa9bYeX9oVY93KspZZBf/I= | ||
| github.com/tetratelabs/wazero v1.9.0/go.mod h1:TSbcXCfFP0L2FGkRPxHphadXPjo1T6W+CseNNY7EkjM= |
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.
This line the actual fix in this PR. The rest is testing support and making it run more nicely on macOS.