aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-06-01 02:02:48 +0200
committerMattias Andrée <maandree@operamail.com>2014-06-01 02:02:48 +0200
commitd9d33bafa3978efcc5ea1c87cb323aa2ea1f1454 (patch)
tree155c8224e26d5ca50a2cb41b16020f2af96412b8 /src/lib
parentm + doc (diff)
downloadlibgamma-d9d33bafa3978efcc5ea1c87cb323aa2ea1f1454.tar.gz
libgamma-d9d33bafa3978efcc5ea1c87cb323aa2ea1f1454.tar.bz2
libgamma-d9d33bafa3978efcc5ea1c87cb323aa2ea1f1454.tar.xz
m
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r--src/lib/gamma-helper.c7
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));