From d9d33bafa3978efcc5ea1c87cb323aa2ea1f1454 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sun, 1 Jun 2014 02:02:48 +0200 Subject: m MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/lib/gamma-helper.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'src/lib') diff --git a/src/lib/gamma-helper.c b/src/lib/gamma-helper.c index 5e3c09b..11dfa13 100644 --- a/src/lib/gamma-helper.c +++ b/src/lib/gamma-helper.c @@ -106,7 +106,7 @@ static void translate_from_64(signed depth, size_t n, libgamma_gamma_ramps_any_t static int allocated_any_ramp(libgamma_gamma_ramps_any_t* restrict ramps_sys, libgamma_gamma_ramps_any_t ramps, signed depth, size_t* restrict elements) { - size_t n = 0, d; + size_t d, n = ramps.ANY.red_size + ramps.ANY.green_size + ramps.ANY.blue_size; switch (depth) { @@ -119,10 +119,7 @@ static int allocated_any_ramp(libgamma_gamma_ramps_any_t* restrict ramps_sys, return errno = EINVAL, LIBGAMMA_ERRNO_SET; } - n += ramps_sys->ANY. red_size = ramps.ANY. red_size; - n += ramps_sys->ANY.green_size = ramps.ANY.green_size; - n += ramps_sys->ANY. blue_size = ramps.ANY. blue_size; - + ramps_sys->ANY = ramps.ANY; ramps_sys->ANY.red = malloc(n * d); ramps_sys->ANY.green = (void*)(((char*)(ramps_sys->ANY. red)) + ramps.ANY. red_size * d / sizeof(char)); ramps_sys->ANY.blue = (void*)(((char*)(ramps_sys->ANY.green)) + ramps.ANY.green_size * d / sizeof(char)); -- cgit v1.2.3-70-g09d2