Commit 17de62ac authored by cutealien's avatar cutealien

Add filename to error-message when jpg-loading fails.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@4169 dfc29bdd-3216-0410-991c-e03cc46cb475
parent fb80ea20
......@@ -16,6 +16,9 @@ namespace irr
namespace video
{
// Static members
io::path CImageLoaderJPG::Filename;
//! constructor
CImageLoaderJPG::CImageLoaderJPG()
{
......@@ -107,7 +110,9 @@ void CImageLoaderJPG::output_message(j_common_ptr cinfo)
// display the error message.
c8 temp1[JMSG_LENGTH_MAX];
(*cinfo->err->format_message)(cinfo, temp1);
os::Printer::log("JPEG FATAL ERROR",temp1, ELL_ERROR);
core::stringc errMsg("JPEG FATAL ERROR in ");
errMsg += core::stringc(Filename);
os::Printer::log(errMsg.c_str(),temp1, ELL_ERROR);
}
#endif // _IRR_COMPILE_WITH_LIBJPEG_
......@@ -133,9 +138,15 @@ bool CImageLoaderJPG::isALoadableFileFormat(io::IReadFile* file) const
IImage* CImageLoaderJPG::loadImage(io::IReadFile* file) const
{
#ifndef _IRR_COMPILE_WITH_LIBJPEG_
os::Printer::log("Can't load as not compiled with _IRR_COMPILE_WITH_LIBJPEG_:", file->getFileName(), ELL_DEBUG);
return 0;
#else
if (!file)
return 0;
Filename = file->getFileName();
u8 **rowPtr=0;
u8* input = new u8[file->getSize()];
file->read(input, file->getSize());
......
......@@ -100,6 +100,9 @@ private:
data has been read. Often a no-op. */
static void term_source (j_decompress_ptr cinfo);
// Copy filename to have it around for error-messages
static io::path Filename;
#endif // _IRR_COMPILE_WITH_LIBJPEG_
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment