mirror of
https://github.com/RGBCube/serenity
synced 2025-07-23 09:27:35 +00:00
LibGfx: Silence debug spam in the PNG decoder
This commit is contained in:
parent
1f48d5a80d
commit
bc5a862cbe
1 changed files with 6 additions and 0 deletions
|
@ -39,6 +39,8 @@
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
//#define PNG_DEBUG
|
||||||
|
|
||||||
namespace Gfx {
|
namespace Gfx {
|
||||||
|
|
||||||
static const u8 png_header[8] = { 0x89, 'P', 'N', 'G', 13, 10, 26, 10 };
|
static const u8 png_header[8] = { 0x89, 'P', 'N', 'G', 13, 10, 26, 10 };
|
||||||
|
@ -502,13 +504,17 @@ static bool decode_png_header(PNGLoadingContext& context)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (!context.data || context.data_size < sizeof(png_header)) {
|
if (!context.data || context.data_size < sizeof(png_header)) {
|
||||||
|
#ifdef PNG_DEBUG
|
||||||
dbg() << "Missing PNG header";
|
dbg() << "Missing PNG header";
|
||||||
|
#endif
|
||||||
context.state = PNGLoadingContext::State::Error;
|
context.state = PNGLoadingContext::State::Error;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (memcmp(context.data, png_header, sizeof(png_header)) != 0) {
|
if (memcmp(context.data, png_header, sizeof(png_header)) != 0) {
|
||||||
|
#ifdef PNG_DEBUG
|
||||||
dbg() << "Invalid PNG header";
|
dbg() << "Invalid PNG header";
|
||||||
|
#endif
|
||||||
context.state = PNGLoadingContext::State::Error;
|
context.state = PNGLoadingContext::State::Error;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue