mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:57:35 +00:00
LibGfx: Put GIFLoader logging behind GIF_DEBUG
This commit is contained in:
parent
ebfc21509a
commit
967c82c1be
1 changed files with 12 additions and 0 deletions
|
@ -36,6 +36,8 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
//#define GIF_DEBUG
|
||||||
|
|
||||||
namespace Gfx {
|
namespace Gfx {
|
||||||
|
|
||||||
// Row strides and offsets for each interlace pass.
|
// Row strides and offsets for each interlace pass.
|
||||||
|
@ -211,8 +213,10 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_current_code > m_code_table.size()) {
|
if (m_current_code > m_code_table.size()) {
|
||||||
|
#ifdef GIF_DEBUG
|
||||||
dbg() << "Corrupted LZW stream, invalid code: " << m_current_code << " at bit index: "
|
dbg() << "Corrupted LZW stream, invalid code: " << m_current_code << " at bit index: "
|
||||||
<< m_current_bit_index << ", code table size: " << m_code_table.size();
|
<< m_current_bit_index << ", code table size: " << m_code_table.size();
|
||||||
|
#endif
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -341,7 +345,9 @@ static bool decode_frame(GIFLoadingContext& context, size_t frame_index)
|
||||||
while (true) {
|
while (true) {
|
||||||
Optional<u16> code = decoder.next_code();
|
Optional<u16> code = decoder.next_code();
|
||||||
if (!code.has_value()) {
|
if (!code.has_value()) {
|
||||||
|
#ifdef GIF_DEBUG
|
||||||
dbg() << "Unexpectedly reached end of gif frame data";
|
dbg() << "Unexpectedly reached end of gif frame data";
|
||||||
|
#endif
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -479,7 +485,9 @@ static bool load_gif_frame_descriptors(GIFLoadingContext& context)
|
||||||
|
|
||||||
if (extension_type == 0xF9) {
|
if (extension_type == 0xF9) {
|
||||||
if (sub_block.size() != 4) {
|
if (sub_block.size() != 4) {
|
||||||
|
#ifdef GIF_DEBUG
|
||||||
dbg() << "Unexpected graphic control size";
|
dbg() << "Unexpected graphic control size";
|
||||||
|
#endif
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -500,12 +508,16 @@ static bool load_gif_frame_descriptors(GIFLoadingContext& context)
|
||||||
|
|
||||||
if (extension_type == 0xFF) {
|
if (extension_type == 0xFF) {
|
||||||
if (sub_block.size() != 14) {
|
if (sub_block.size() != 14) {
|
||||||
|
#ifdef GIF_DEBUG
|
||||||
dbg() << "Unexpected application extension size: " << sub_block.size();
|
dbg() << "Unexpected application extension size: " << sub_block.size();
|
||||||
|
#endif
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sub_block[11] != 1) {
|
if (sub_block[11] != 1) {
|
||||||
|
#ifdef GIF_DEBUG
|
||||||
dbg() << "Unexpected application extension format";
|
dbg() << "Unexpected application extension format";
|
||||||
|
#endif
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue