mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-25 00:55:11 +01:00
std/webp: tweak workbuf_len determination
This commit is contained in:
1 parent
c4df79d82e
commit
466cf6f15d
12 files changed
+106
-90
No files matched your search
@@ -518,6 +518,9 @@ redirect:
|
||||
// Allocate the work buffer. Wuffs' decoders conventionally assume that this
|
||||
// can be uninitialized memory.
|
||||
wuffs_base__range_ii_u64 workbuf_len = image_decoder->workbuf_len();
|
||||
if (workbuf_len.is_empty()) {
|
||||
return DecodeImageResult(DecodeImage_UnsupportedImageFormat);
|
||||
}
|
||||
DecodeImageCallbacks::AllocWorkbufResult alloc_workbuf_result =
|
||||
callbacks.AllocWorkbuf(workbuf_len, true);
|
||||
if (!alloc_workbuf_result.error_message.empty()) {
|
||||
|
||||
@@ -162,6 +162,8 @@ class DecodeImageCallbacks {
|
||||
// should be at least len_range.min_incl, but larger allocations (up to
|
||||
// len_range.max_incl) may have better performance (by using more memory).
|
||||
//
|
||||
// The len_range argument will satisfy !len_range.is_empty().
|
||||
//
|
||||
// The default AllocWorkbuf implementation allocates len_range.max_incl bytes
|
||||
// of either uninitialized or zeroed memory.
|
||||
virtual AllocWorkbufResult //
|
||||
|
||||
Reference in new issue
Block a user