diff options
author | Robin Watts <Robin.Watts@artifex.com> | 2022-02-16 19:04:50 +0000 |
---|---|---|
committer | Robin Watts <Robin.Watts@artifex.com> | 2022-02-17 11:26:06 +0000 |
commit | b357e4765038eb4b970cfabb4cfdf74b851b377b (patch) | |
tree | bfd42046b29ef25143f3d89489f1c6cda18641f6 /base/gsicc_create.c | |
parent | 978e5ddebcf47ba2263f6908e485c01538c9fdb9 (diff) | |
download | ghostpdl-b357e4765038eb4b970cfabb4cfdf74b851b377b.tar.gz |
Coverity 375669: cc.paint.values are not used uninitialized.
Make it clear that we always initialize the required values.
Diffstat (limited to 'base/gsicc_create.c')
-rw-r--r-- | base/gsicc_create.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/base/gsicc_create.c b/base/gsicc_create.c index 3d691223e..c9a586b2e 100644 --- a/base/gsicc_create.c +++ b/base/gsicc_create.c @@ -345,13 +345,14 @@ gsicc_create_clut(const gs_color_space *pcs, gsicc_clut *clut, gs_range *ranges, Uniformly from min range to max range */ ptr_short = clut->data_short; for (i = 0; i < num_points; i++) { - if (num_components == 1) { + switch (num_components) { + case 1: /* Get the input vector value */ fltptr = input_samples[0]; index = i%table_size; cc.paint.values[0] = fltptr[index]; - } - if (num_components == 3) { + break; + case 3: /* The first channel varies least rapidly in the ICC table */ fltptr = input_samples[2]; index = i%table_size; @@ -363,8 +364,8 @@ gsicc_create_clut(const gs_color_space *pcs, gsicc_clut *clut, gs_range *ranges, index = (unsigned int) floor((float) i/(float) (table_size* table_size))%table_size; cc.paint.values[0] = fltptr[index]; - } - if (num_components == 4) { + break; + case 4: /* The first channel varies least rapidly in the ICC table */ fltptr = input_samples[3]; index = i%table_size; @@ -380,6 +381,9 @@ gsicc_create_clut(const gs_color_space *pcs, gsicc_clut *clut, gs_range *ranges, index = (unsigned int) floor((float) i/(float) (table_size* table_size*table_size))%table_size; cc.paint.values[0] = fltptr[index]; + break; + default: + return_error(gs_error_rangecheck); /* Should never happen */ } /* These special concretizations functions do not go through the ICC mapping like the procs associated with the color space */ |