[gdk-pixbuf] tests: Limit the number of bytes we modify per test to 100



commit 7ec2bd239421ac18d56194160f21aa3262bd2312
Author: Benjamin Otte <otte redhat com>
Date:   Mon Oct 12 17:30:17 2015 +0200

    tests: Limit the number of bytes we modify per test to 100
    
    It doesn't make sense to use file_size / 4 because once a file is
    broken, it's broken. Breaking it even more is not very useful.

 tests/pixbuf-randomly-modified.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/tests/pixbuf-randomly-modified.c b/tests/pixbuf-randomly-modified.c
index 93722fd..9f482e4 100644
--- a/tests/pixbuf-randomly-modified.c
+++ b/tests/pixbuf-randomly-modified.c
@@ -34,12 +34,14 @@
 static void
 randomly_modify (const gchar *image, guint size)
 {
-  int i;
+  int i, n;
 
   guchar *img_copy = g_malloc (size);
   g_memmove (img_copy, image, size);
   
-  for (i = 0; i < size / 4; i++)
+  n = MIN (100, size / 4);
+
+  for (i = 0; i < n; i++)
     {
       FILE *f;
       GdkPixbufLoader *loader;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]