From 9ea709e1f304018d47c0fe3be22fae56dc2ccbe2 Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Wed, 18 Nov 2020 09:59:20 -0500 Subject: [PATCH] LibGfx: Put PPM logs behind (default-off) PPM_DEBUG --- Libraries/LibGfx/PPMLoader.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Libraries/LibGfx/PPMLoader.cpp b/Libraries/LibGfx/PPMLoader.cpp index d891821877..e41a2cfb57 100644 --- a/Libraries/LibGfx/PPMLoader.cpp +++ b/Libraries/LibGfx/PPMLoader.cpp @@ -32,6 +32,8 @@ #include #include +//#define PPM_DEBUG + namespace Gfx { struct PPMLoadingContext { @@ -168,14 +170,18 @@ static bool read_magic_number(PPMLoadingContext& context, Streamer& streamer) if (!context.data || context.data_size < 2) { context.state = PPMLoadingContext::State::Error; - dbg() << "There is no enough data."; +#ifdef PPM_DEBUG + dbg() << "There is not enough data."; +#endif return false; } u8 magic_number[2]; if (!streamer.read_bytes(magic_number, 2)) { context.state = PPMLoadingContext::State::Error; +#ifdef PPM_DEBUG dbg() << "We can't read magic number."; +#endif return false; } @@ -192,7 +198,9 @@ static bool read_magic_number(PPMLoadingContext& context, Streamer& streamer) } context.state = PPMLoadingContext::State::Error; +#ifdef PPM_DEBUG dbg() << "Magic number is not valid." << (char)magic_number[0] << (char)magic_number[1]; +#endif return false; } @@ -255,7 +263,9 @@ static bool read_max_val(PPMLoadingContext& context, Streamer& streamer) } if (context.max_val > 255) { - dbg() << "We can't pars 2 byte color."; +#ifdef PPM_DEBUG + dbg() << "We can't parse 2 byte color."; +#endif context.state = PPMLoadingContext::Error; return false; }