plug-ins: avoid log-spamming by tiff plug-in

* last log I checked had over 30.000 tiff msgs
* limit tiff_io_warning() and tiff_io_error() to a max of 3 msgs
This commit is contained in:
Rupert 2024-11-19 01:37:19 +01:00 committed by Jehan
parent 08fa28d6f9
commit 4730ec4eb0

View file

@ -163,6 +163,8 @@ tiff_reset_file_size_error (void)
tiff_file_size_error = FALSE;
}
static gint max_msgs_per_instance = 3;
static void
tiff_io_warning (const gchar *module,
const gchar *fmt,
@ -170,6 +172,11 @@ tiff_io_warning (const gchar *module,
{
gint tag = 0;
if (max_msgs_per_instance > 0)
max_msgs_per_instance--;
else
return;
/* Between libtiff 3.7.0beta2 and 4.0.0alpha. */
if (! strcmp (fmt, "%s: unknown field with tag %d (0x%x) encountered") ||
/* Before libtiff 3.7.0beta2. */
@ -280,6 +287,11 @@ tiff_io_error (const gchar *module,
{
gchar *msg;
if (max_msgs_per_instance > 0)
max_msgs_per_instance--;
else
return;
/* Workaround for: http://bugzilla.gnome.org/show_bug.cgi?id=132297
* Ignore the errors related to random access and JPEG compression
*/