summaryrefslogtreecommitdiff
path: root/src/cmspcs.c
diff options
context:
space:
mode:
authorMarti Maria <marti.maria@littlecms.com>2022-08-31 23:28:59 +0200
committerMarti Maria <marti.maria@littlecms.com>2022-08-31 23:28:59 +0200
commite515daaa2259657319eb9f07181d02af24b4e7fe (patch)
tree2a4017058ecf4c21b5c2bb836a4c0f058fc445c3 /src/cmspcs.c
parent682d84ccdc6d6f33b73557d8c2e2e73fc4c31025 (diff)
downloadlcms2-e515daaa2259657319eb9f07181d02af24b4e7fe.tar.gz
An old function was returning a wrong value
It makes no sense that cmsChannelsOf() returns 3 when colorspace is bugus. Added a new function that returns -1 instead. Will document that in 2.15. It is in the API now, but not in docs.
Diffstat (limited to 'src/cmspcs.c')
-rw-r--r--src/cmspcs.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/cmspcs.c b/src/cmspcs.c
index 3d6323a..a0f1952 100644
--- a/src/cmspcs.c
+++ b/src/cmspcs.c
@@ -874,7 +874,7 @@ int CMSEXPORT _cmsLCMScolorSpace(cmsColorSpaceSignature ProfileSpace)
}
-cmsUInt32Number CMSEXPORT cmsChannelsOf(cmsColorSpaceSignature ColorSpace)
+cmsInt32Number CMSEXPORT cmsChannelsOfColorSpace(cmsColorSpaceSignature ColorSpace)
{
switch (ColorSpace) {
@@ -935,6 +935,16 @@ cmsUInt32Number CMSEXPORT cmsChannelsOf(cmsColorSpaceSignature ColorSpace)
case cmsSigMCHFData:
case cmsSig15colorData: return 15;
- default: return 3;
+ default: return -1;
}
}
+
+/**
+* DEPRECATED: Provided for compatibility only
+*/
+cmsUInt32Number CMSEXPORT cmsChannelsOf(cmsColorSpaceSignature ColorSpace)
+{
+ int n = cmsChannelsOfColorSpace(ColorSpace);
+ if (n < 0) return 3;
+ return (cmsUInt32Number)n;
+} \ No newline at end of file