linking against png 1.5

  Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
abs0 Offline
Junior Member
Posts: 12
Joined: Jun 2011
Reputation: 0
Location: London
Post: #1
One of the changes in png 1.5 has been to hide the internal contents of png_struct_def

xbmc/lib/cximage-6.0/CxImage/ximapng.{cpp,h} use png_struct_def directly when setting up a customer error handler:

ximapng.cpp
Code:
png_set_error_fn(png_ptr,info.szLastError,/*(png_error_ptr)*/user_error_fn,NULL);

ximapng.h
Code:
static void PNGAPI user_error_fn(png_structp png_ptr,png_const_charp error_msg)
        {
                strncpy((char*)png_ptr->error_ptr,error_msg,255);
                longjmp(png_ptr->jmpbuf, 1);
        }

Its not entirely clear what is going on here - it looks like user_error_fn() is setup to pretty much reproduce png_error(), but without displaying any message to stderr. What is curious is that the png_set_error_fn() only ovverrides png_warning(), not png_error(), so any call to png_warning() will still be echoing content to stderr, plus ximapng.h calls png_error() directly in some cases.

Am I missing anything obvious where - why is user_error_fn() needed at all?

Thanks
find quote
spiff Offline
Grumpy Bastard Developer
Posts: 12,187
Joined: Nov 2003
Reputation: 82
Post: #2
probably xbox leftovers - we had no cout/cerr there...

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.
find quote
abs0 Offline
Junior Member
Posts: 12
Joined: Jun 2011
Reputation: 0
Location: London
Post: #3
spiff Wrote:probably xbox leftovers - we had no cout/cerr there...

OK thanks. Those files are full of direct png_struct_def usage - will try to take a pass through to update them all to the approved png API calls, and just drop the png_set_error_fn() usage...
find quote