Skip to content

support for customize inflate#81

Open
kanryu wants to merge 1 commit intolvandeve:masterfrom
kanryu:master
Open

support for customize inflate#81
kanryu wants to merge 1 commit intolvandeve:masterfrom
kanryu:master

Conversation

@kanryu
Copy link

@kanryu kanryu commented Dec 27, 2018

hi,

I tried to customize inflate () in your library, but actually I could not. Because custom_inflate will always be 0.

Therefore, I propose to add lodepng_decoder_settings_user_regist() API. Calling this API before actually handling png first will customize the initialization by lodepng_decoder_settings_init() and will be able to use custom_inflate etc.

Another suggestion is to add size_t outbuffsize to the custom_inflate function. In other deflate implementations such as libdeflate, the memory size secured in the output destination buffer is required as a parameter. If you give 0 to this you can not actually return an error.

// initial setting
LodePNGDecoderSettings decoderSettings = { 0 };
lodepng_decoder_settings_init(&decoderSettings);
decoderSettings.zlibsettings.custom_inflate = my_custom_inflate;
lodepng_decoder_settings_user_regist(&decoderSettings);
// begin decoding
error = lodepng_decode32_file(&image, &width, &height, filename);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant