Menu

#261 The function of error_ptr is undocumented

closed-fixed
None
5
2017-06-29
2017-01-26
martijn
No

In png_set_error_fn the user can set a custom error_ptr. The purpose of this error_ptr is undocumented. I assume it to be a 'userdata' pointer for the error functions but this is unclear from the documentation.

Discussion

  • Glenn Randers-Pehrson

    The libpng manpage has this:

    We also pass the library version, optional
    pointers to error handling functions, and a pointer to a data struct for
    use by the error functions, if necessary (the pointer and functions can
    be NULL if the default error handlers are to be used).

    contrib/gregbook/ readpng2.c and writepng.c, contrib/libtests/pngvalid.c,
    and several other programs in the contrib directory have of examples of png_get_error_ptr() usage.

     
  • Glenn Randers-Pehrson

    • assigned_to: Glenn Randers-Pehrson
     
  • martijn

    martijn - 2017-01-27

    Maybe a pointer to this info should be included in the documentation of png_set_error_fn() ? Because I did not find the above documentation (I tried grepping through the docs for 'error_ptr' but since that exact phrase does not occur in this text I had not found it.)

     
  • Glenn Randers-Pehrson

    In libpng-1.6.30beta01 I'm adding, in the description of
    the error_fn in libpng.3 and libpng-manual.txt,

    +Then, within your user_error_fn or user_warning_fn, you can retrieve
    +the error_ptr if you need it, by calling
    +
    + png_voidp error_ptr = png_get_error_ptr(png_ptr);
    +

     

    Last edit: Glenn Randers-Pehrson 2017-03-28
  • Glenn Randers-Pehrson

    Fixed in libpng-1.6.30

     
  • Glenn Randers-Pehrson

    • status: open --> closed-fixed
     

Log in to post a comment.