diff options
author | Mattias Andrée <maandree@operamail.com> | 2014-06-01 02:02:48 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2014-06-01 02:02:48 +0200 |
commit | d9d33bafa3978efcc5ea1c87cb323aa2ea1f1454 (patch) | |
tree | 155c8224e26d5ca50a2cb41b16020f2af96412b8 | |
parent | m + doc (diff) | |
download | libgamma-d9d33bafa3978efcc5ea1c87cb323aa2ea1f1454.tar.gz libgamma-d9d33bafa3978efcc5ea1c87cb323aa2ea1f1454.tar.bz2 libgamma-d9d33bafa3978efcc5ea1c87cb323aa2ea1f1454.tar.xz |
m
Signed-off-by: Mattias Andrée <maandree@operamail.com>
-rw-r--r-- | src/lib/gamma-helper.c | 7 |
1 files changed, 2 insertions, 5 deletions
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)); |