[babl] babl: fix bug in icc tag alignment



commit adb41b1b591597ad759108d3ecdffda7ab761758
Author: Øyvind Kolås <pippin gimp org>
Date:   Mon Jul 9 16:29:42 2018 +0200

    babl: fix bug in icc tag alignment

 babl/babl-icc.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/babl/babl-icc.c b/babl/babl-icc.c
index ed6e0cc..9d520b9 100644
--- a/babl/babl-icc.c
+++ b/babl/babl-icc.c
@@ -392,7 +392,10 @@ static const Babl *babl_trc_from_icc (ICC  *state, int offset,
 
 static void icc_allocate_tag (ICC *state, const char *tag, int size)
 {
-    state->no+=((4-state->o)%4);state->o = state->no;state->psize = size;
+    while (state->no % 4 != 0)
+      state->no++;
+
+    state->o = state->no;state->psize = size;
     icc_write (sign, 128 + 4 + 4 * state->headpos++, tag);
     icc_write (u32,  128 + 4 + 4 * state->headpos++, state->o);
     icc_write (u32,  128 + 4 + 4 * state->headpos++, size);


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