[babl] babl: initialize the bpp of fishes loaded from cache



commit b34a9672c8c9a42923a8f0b2650af30b1efe635c
Author: Øyvind Kolås <pippin gimp org>
Date:   Sat Jan 20 18:41:12 2018 +0100

    babl: initialize the bpp of fishes loaded from cache
    
    The cache loading code manually constructs path fishes, which did not
    get their bpp initialized, this resulted in conversions of long runs to
    fail, not crash - but stop processing after MAX_BUFFER_SIZE pixels.

 babl/babl-cache.c     |    2 ++
 babl/babl-fish-path.c |    6 +++---
 babl/babl-internal.h  |    1 +
 3 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/babl/babl-cache.c b/babl/babl-cache.c
index 75780b5..33d030d 100644
--- a/babl/babl-cache.c
+++ b/babl/babl-cache.c
@@ -289,6 +289,8 @@ void babl_init_db (void)
             babl->fish.source               = from_format;
             babl->fish.destination          = to_format;
             babl->fish_path.conversion_list = babl_list_init_with_size (10);
+            _babl_fish_prepare_bpp (babl);
+            _babl_fish_rig_dispatch (babl);
 
             token2 = strtok_r (&token[1], seps2, &tokp2);
             while( token2 != NULL )
diff --git a/babl/babl-fish-path.c b/babl/babl-fish-path.c
index d387fa8..54e9ee4 100644
--- a/babl/babl-fish-path.c
+++ b/babl/babl-fish-path.c
@@ -433,8 +433,8 @@ alias_conversion (Babl *babl,
   return 0;
 }
 
-static void
-babl_fish_prepare_bpp (Babl *babl)
+void
+_babl_fish_prepare_bpp (Babl *babl)
 {
    const Babl *babl_source = babl->fish.source;
    const Babl *babl_dest = babl->fish.destination;
@@ -604,7 +604,7 @@ babl_fish_path2 (const Babl *source,
       return NULL;
     }
 
-  babl_fish_prepare_bpp (babl);
+  _babl_fish_prepare_bpp (babl);
   _babl_fish_rig_dispatch (babl);
   /* Since there is not an already registered instance by the required
    * name, inserting newly created class into database.
diff --git a/babl/babl-internal.h b/babl/babl-internal.h
index 415bc5e..896ae81 100644
--- a/babl/babl-internal.h
+++ b/babl/babl-internal.h
@@ -498,5 +498,6 @@ babl_conversion_process (const Babl *babl,
 }
 
 void _babl_fish_rig_dispatch (Babl *babl);
+void _babl_fish_prepare_bpp (Babl *babl);
 
 #endif


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