/*------------------------------------------------------------------------------
 src/plugin/djImageIoJpeg/base.cxx
 
 Copyright (c) 2004-2006 Darby Johnston.
 All rights reserved.
 Use is subject to license terms.
------------------------------------------------------------------------------*/

//#define DJ_DBG
#include "base.h"

namespace djImageIoJpeg {

extern "C" {

void jpegError(j_common_ptr in)
{
  DJ_DBG_FNC("djImageIoJpeg::jpegError");

  char msg [JMSG_LENGTH_MAX];
  in->err->format_message(in, msg);
  DJ_DBG_PRN("message = " << msg);

  Error * error = (Error *)in->err;
  longjmp(error->jump, 1);
}

void jpegWarning(j_common_ptr in, int level)
{
  if (level > 0) return;

  DJ_DBG_FNC("djImageIoJpeg::jpegWarning");

  char msg [JMSG_LENGTH_MAX];
  in->err->format_message(in, msg);
  DJ_DBG_PRN("message = " << msg);
}

}

}
