summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Deutschmann <whissi@gentoo.org>2021-09-27 11:19:24 +0200
committerThomas Deutschmann <whissi@gentoo.org>2021-10-20 18:22:47 +0200
commitcc6be9c3577168805ec34b2d396e63361012282b (patch)
tree7dc794b08a1a6a786d540516c623cb1eebfb1863 /base/gsicc_manage.c
parentImport Ghostscript 9.54 (diff)
downloadghostscript-gpl-patches-cc6be9c3577168805ec34b2d396e63361012282b.tar.gz
ghostscript-gpl-patches-cc6be9c3577168805ec34b2d396e63361012282b.tar.bz2
ghostscript-gpl-patches-cc6be9c3577168805ec34b2d396e63361012282b.zip
Import Ghostscript 9.55ghostscript-9.55
Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
Diffstat (limited to 'base/gsicc_manage.c')
-rw-r--r--base/gsicc_manage.c33
1 files changed, 20 insertions, 13 deletions
diff --git a/base/gsicc_manage.c b/base/gsicc_manage.c
index 4cf82e0c..0842628d 100644
--- a/base/gsicc_manage.c
+++ b/base/gsicc_manage.c
@@ -759,7 +759,7 @@ gsicc_set_srcgtag_struct(gsicc_manager_t *icc_manager, const char* pname,
/* Color tune profile. No intent */
srcgtag->color_warp_profile = icc_profile;
break;
- case GRAPHIC_CMYK:
+ case VECTOR_CMYK:
srcgtag->cmyk_profiles[gsSRC_GRAPPRO] = icc_profile;
srcgtag->cmyk_rend_cond[gsSRC_GRAPPRO].cmm = cmm;
if (cmm == gsCMM_DEFAULT) {
@@ -786,7 +786,7 @@ gsicc_set_srcgtag_struct(gsicc_manager_t *icc_manager, const char* pname,
return code;
}
break;
- case GRAPHIC_RGB:
+ case VECTOR_RGB:
srcgtag->rgb_profiles[gsSRC_GRAPPRO] = icc_profile;
srcgtag->rgb_rend_cond[gsSRC_GRAPPRO].cmm = cmm;
if (cmm == gsCMM_DEFAULT) {
@@ -813,7 +813,7 @@ gsicc_set_srcgtag_struct(gsicc_manager_t *icc_manager, const char* pname,
return code;
}
break;
- case GRAPHIC_GRAY:
+ case VECTOR_GRAY:
srcgtag->gray_profiles[gsSRC_GRAPPRO] = icc_profile;
srcgtag->gray_rend_cond[gsSRC_GRAPPRO].cmm = cmm;
if (cmm == gsCMM_DEFAULT) {
@@ -1586,8 +1586,15 @@ gsicc_set_device_profile_colorants(gx_device *dev, char *name_str)
char temp_str[DEFAULT_ICC_COLORANT_LENGTH+2];
/* If names are already set then we do not want to set default ones */
- if (profile_struct->spotnames != NULL)
- return 0;
+ if (profile_struct->spotnames != NULL) {
+ /* Check if we have at least as many spot names
+ as there are channels in the proFfile */
+ if (num_comps > profile_struct->spotnames->count) {
+ gs_warn("ICC profile colorant names count insufficient");
+ return_error(gs_error_rangecheck);
+ } else
+ return 0;
+ }
free_str = true;
/* Assume first 4 are CMYK */
@@ -1933,7 +1940,7 @@ gsicc_set_device_profile(gx_device * pdev, gs_memory_t * mem,
{
cmm_profile_t *icc_profile;
stream *str;
- int code;
+ int code = 0;
/* This is slightly silly, we have a device method for 'get_profile' we really ought to
* have one for 'set_profile' as well. In its absence, make sure we are setting the profile
@@ -2047,7 +2054,7 @@ gsicc_set_device_profile(gx_device * pdev, gs_memory_t * mem,
break;
default:
/* NCLR Profile. Set up default colorant names */
- gsicc_set_device_profile_colorants(pdev, NULL);
+ code = gsicc_set_device_profile_colorants(pdev, NULL);
break;
}
if_debug1m(gs_debug_flag_icc, mem, "[icc] Profile data CS is %d\n",
@@ -2055,7 +2062,7 @@ gsicc_set_device_profile(gx_device * pdev, gs_memory_t * mem,
} else
return gs_rethrow(-1, "cannot find device profile");
}
- return 0;
+ return code;
}
/* Set the icc profile in the gs_color_space object */
@@ -2796,10 +2803,10 @@ gsicc_extract_profile(gs_graphics_type_tag_t graphics_type_tag,
(*profile) = profile_struct->device_profile[GS_DEFAULT_DEVICE_PROFILE];
*render_cond = profile_struct->rendercond[GS_DEFAULT_DEVICE_PROFILE];
break;
- case GS_PATH_TAG:
- *render_cond = profile_struct->rendercond[GS_GRAPHIC_DEVICE_PROFILE];
- if (profile_struct->device_profile[GS_GRAPHIC_DEVICE_PROFILE] != NULL) {
- (*profile) = profile_struct->device_profile[GS_GRAPHIC_DEVICE_PROFILE];
+ case GS_VECTOR_TAG:
+ *render_cond = profile_struct->rendercond[GS_VECTOR_DEVICE_PROFILE];
+ if (profile_struct->device_profile[GS_VECTOR_DEVICE_PROFILE] != NULL) {
+ (*profile) = profile_struct->device_profile[GS_VECTOR_DEVICE_PROFILE];
} else {
(*profile) = profile_struct->device_profile[GS_DEFAULT_DEVICE_PROFILE];
}
@@ -2863,7 +2870,7 @@ dump_icc_buffer(const gs_memory_t *mem, int buffersize, char filename[],byte *Bu
gs_sprintf(full_file_name,"%d)%s_debug.icc",global_icc_index,filename);
fid = gp_fopen(mem, full_file_name,"wb");
gp_fwrite(Buffer,sizeof(unsigned char),buffersize,fid);
- fclose(fid);
+ gp_fclose(fid);
}
#endif