LibJPEG warnings are not all being captured by FreeImage_SetOutputMessage()

Help
2014-04-21
2014-04-21
  • Michael Leib
    Michael Leib
    2014-04-21

    Hopefully someone can help me with this issue. I'm using using FreeImage 3.15.3.

    I keep randomly getting "Premature end of JPEG file" coming at me from stdout when reading
    .jpg files (in realtime, off the web) which probably are not fully written at time of my processing. My issue is not with the message, but how the message is handled.

    In my code, I have:

    FreeImage_Initialise( 0 );
    FreeImage_SetOutputMessage( scaler_message_func );

    with the function being defined as

    void scaler_message_func( FREE_IMAGE_FORMAT fif, const char *message )
    {
    DLOG( "scaler_message_func" );

        log_out( LOG_WARN, "FreeImage: %s", message );
    

    } / }}} /

    where log_out() does not write to stdout, but rather, a logfile mechanism.
    Nothing should be written out otherwise.

    Is there some reason why this is not being caught (I know it originates in LIbJPEG)
    and presented to the application via the documented API?

    Thanks in advance,

    Michael