[babl] babl: initialize 'palette' babl-format member



commit 6527d112086795c42912abfb5ad20fee68db295d
Author: Massimo Valentini <mvalentini src gnome org>
Date:   Fri May 4 19:04:03 2012 +0200

    babl: initialize 'palette' babl-format member
    
    otherwise non-palette formats could be mistakenly used as palette

 babl/babl-format.c |    1 +
 tests/palette.c    |    1 +
 2 files changed, 2 insertions(+), 0 deletions(-)
---
diff --git a/babl/babl-format.c b/babl/babl-format.c
index 0a7a840..6fc0a9c 100644
--- a/babl/babl-format.c
+++ b/babl/babl-format.c
@@ -115,6 +115,7 @@ format_new (const char     *name,
   babl->format.visited = 0;
   babl->format.image_template = NULL;
   babl->format.format_n = 0;
+  babl->format.palette = 0;
 
   return babl;
 }
diff --git a/tests/palette.c b/tests/palette.c
index aaf98c8..8519262 100644
--- a/tests/palette.c
+++ b/tests/palette.c
@@ -29,6 +29,7 @@ main (int    argc,
 {
   int OK = 1;
   babl_init ();
+  OK = ! babl_format_is_palette (babl_format_n (babl_type ("double"), 3));
   if(1){
     unsigned char in[][1]   = {{        0},{          1},{          2},{15}};
     unsigned char out[][4]  = {{0,0,0,255},{127,0,0,255},{0,127,0,255},{255,255,255,255}};



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