Libpng 1.5.10 error: dereferencing pointer to an incomplete type

png_read_info (png_ptr, info_ptr); { png_byte color_type = info_ptr->color_type; png_byte bit_depth = info_ptr->bit_depth; ... 

For the last two lines, I get

error: dereference pointer to incomplete type

What happened? In libpng 1.4, this was always normal.

+6
source share
1 answer

The png_info structure was removed from png.h in 1.5.0, and now you should use this pointer with the png_get_* and png_set_* functions.

As pointed out in the libpng manual :

The png_info structure is intended to provide information about a PNG file. At one time, png_info fields should have been directly accessible to the user. However, this, as a rule, caused problems with applications using dynamically loaded libraries, and as a result, the set of interface functions for png_info (png_get _ * () and png_set _ * ()), and direct access to the png_info Fields are deprecated.

For instance:

 png_uint_32 height; height = png_get_image_height( png_ptr, info_ptr); 
+17
source

Source: https://habr.com/ru/post/915239/


All Articles