summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarti Maria <info@littlecms.com>2013-03-19 12:23:51 +0100
committerMarti Maria <info@littlecms.com>2013-03-19 12:23:51 +0100
commitb58cb85ed8a58b0aeed96b54e599a048d80a10fb (patch)
tree2f9da185ea8334569c681061ef1352525c91afa2 /src
parentd504603d162102961467e5d23f40eba4c91bc91f (diff)
downloadlcms2-b58cb85ed8a58b0aeed96b54e599a048d80a10fb.tar.gz
Fix cppcheck warnings
Diffstat (limited to 'src')
-rw-r--r--src/cmsgmt.c13
-rw-r--r--src/cmslut.c9
-rw-r--r--src/cmsps2.c5
-rw-r--r--src/cmstypes.c8
-rw-r--r--src/cmsxform.c7
5 files changed, 13 insertions, 29 deletions
diff --git a/src/cmsgmt.c b/src/cmsgmt.c
index 601ec29..70e8db0 100644
--- a/src/cmsgmt.c
+++ b/src/cmsgmt.c
@@ -220,13 +220,10 @@ int GamutSampler(register const cmsUInt16Number In[], register cmsUInt16Number O
cmsFloat64Number dE1, dE2, ErrorRatio;
// Assume in-gamut by default.
- dE1 = 0.;
- dE2 = 0;
ErrorRatio = 1.0;
// Convert input to Lab
- if (t -> hInput != NULL)
- cmsDoTransform(t -> hInput, In, &LabIn1, 1);
+ cmsDoTransform(t -> hInput, In, &LabIn1, 1);
// converts from PCS to colorant. This always
// does return in-gamut values,
@@ -238,7 +235,7 @@ int GamutSampler(register const cmsUInt16Number In[], register cmsUInt16Number O
memmove(&LabIn2, &LabOut1, sizeof(cmsCIELab));
// Try again, but this time taking Check as input
- cmsDoTransform(t -> hForward, &LabOut1, Proof2, 1);
+ cmsDoTransform(t -> hForward, &LabOut1, Proof2, 1);
cmsDoTransform(t -> hReverse, Proof2, &LabOut2, 1);
// Take difference of direct value
@@ -345,7 +342,7 @@ cmsPipeline* _cmsCreateGamutCheckPipeline(cmsContext ContextID,
ProfileList[nGamutPCSposition] = hLab;
BPCList[nGamutPCSposition] = 0;
AdaptationList[nGamutPCSposition] = 1.0;
- Intents[nGamutPCSposition] = INTENT_RELATIVE_COLORIMETRIC;
+ IntentList[nGamutPCSposition] = INTENT_RELATIVE_COLORIMETRIC;
ColorSpace = cmsGetColorSpace(hGamut);
@@ -359,7 +356,7 @@ cmsPipeline* _cmsCreateGamutCheckPipeline(cmsContext ContextID,
nGamutPCSposition + 1,
ProfileList,
BPCList,
- Intents,
+ IntentList,
AdaptationList,
NULL, 0,
dwFormat, TYPE_Lab_DBL,
@@ -382,7 +379,7 @@ cmsPipeline* _cmsCreateGamutCheckPipeline(cmsContext ContextID,
// All ok?
- if (Chain.hForward && Chain.hReverse) {
+ if (Chain.hInput && Chain.hForward && Chain.hReverse) {
// Go on, try to compute gamut LUT from PCS. This consist on a single channel containing
// dE when doing a transform back and forth on the colorimetric intent.
diff --git a/src/cmslut.c b/src/cmslut.c
index 5c88b54..2d8e7eb 100644
--- a/src/cmslut.c
+++ b/src/cmslut.c
@@ -1684,16 +1684,11 @@ cmsBool CMSEXPORT cmsPipelineEvalReverseFloat(cmsFloat32Number Target[],
cmsFloat32Number fx[4], x[4], xd[4], fxd[4];
cmsVEC3 tmp, tmp2;
cmsMAT3 Jacobian;
- cmsFloat64Number LastResult[4];
-
-
+
// Only 3->3 and 4->3 are supported
if (lut ->InputChannels != 3 && lut ->InputChannels != 4) return FALSE;
if (lut ->OutputChannels != 3) return FALSE;
-
- // Mark result of -1
- LastResult[0] = LastResult[1] = LastResult[2] = -1.0f;
-
+
// Take the hint as starting point if specified
if (Hint == NULL) {
diff --git a/src/cmsps2.c b/src/cmsps2.c
index 1792129..a469a97 100644
--- a/src/cmsps2.c
+++ b/src/cmsps2.c
@@ -777,7 +777,6 @@ int EmitCIEBasedDEF(cmsIOHANDLER* m, cmsPipeline* Pipeline, int Intent, cmsCIEXY
mpe = Pipeline ->Elements;
-
switch (cmsStageInputChannels(mpe)) {
case 3:
@@ -809,8 +808,6 @@ int EmitCIEBasedDEF(cmsIOHANDLER* m, cmsPipeline* Pipeline, int Intent, cmsCIEXY
mpe = mpe ->Next;
}
-
-
if (cmsStageType(mpe) == cmsSigCLutElemType) {
_cmsIOPrintf(m, "/Table ");
@@ -825,7 +822,6 @@ int EmitCIEBasedDEF(cmsIOHANDLER* m, cmsPipeline* Pipeline, int Intent, cmsCIEXY
_cmsIOPrintf(m, " >>\n");
_cmsIOPrintf(m, "]\n");
-
return 1;
}
@@ -921,6 +917,7 @@ int WriteInputLUT(cmsIOHANDLER* m, cmsHPROFILE hProfile, int Intent, cmsUInt32Nu
rc = EmitCIEBasedDEF(m, DeviceLink, Intent, &BlackPointAdaptedToD50);
cmsPipelineFree(DeviceLink);
+ if (rc == 0) return 0;
}
break;
diff --git a/src/cmstypes.c b/src/cmstypes.c
index 3fb7531..0428a04 100644
--- a/src/cmstypes.c
+++ b/src/cmstypes.c
@@ -427,6 +427,7 @@ static
void* Type_Chromaticity_Dup(struct _cms_typehandler_struct* self, const void *Ptr, cmsUInt32Number n)
{
return _cmsDupMem(self ->ContextID, Ptr, sizeof(cmsCIExyYTRIPLE));
+
cmsUNUSED_PARAMETER(n);
}
@@ -1783,10 +1784,7 @@ void *Type_LUT8_Read(struct _cms_typehandler_struct* self, cmsIOHANDLER* io, cms
if (nTabSize > 0) {
cmsUInt16Number *PtrW, *T;
- cmsUInt32Number Tsize;
-
- Tsize = (cmsUInt32Number) nTabSize * sizeof(cmsUInt16Number);
-
+
PtrW = T = (cmsUInt16Number*) _cmsCalloc(self ->ContextID, nTabSize, sizeof(cmsUInt16Number));
if (T == NULL) goto Error;
@@ -2004,7 +2002,7 @@ cmsBool Write16bitTables(cmsContext ContextID, cmsIOHANDLER* io, _cmsStageToneCu
int j;
cmsUInt32Number i;
cmsUInt16Number val;
- int nEntries = 256;
+ int nEntries;
_cmsAssert(Tables != NULL);
diff --git a/src/cmsxform.c b/src/cmsxform.c
index 0b0dd00..02a9f3c 100644
--- a/src/cmsxform.c
+++ b/src/cmsxform.c
@@ -634,8 +634,7 @@ cmsHTRANSFORM CMSEXPORT cmsCreateExtendedTransform(cmsContext ContextID,
cmsUInt32Number OutputFormat,
cmsUInt32Number dwFlags)
{
- _cmsTRANSFORM* xform;
- cmsBool FloatTransform;
+ _cmsTRANSFORM* xform;
cmsColorSpaceSignature EntryColorSpace;
cmsColorSpaceSignature ExitColorSpace;
cmsPipeline* Lut;
@@ -652,9 +651,7 @@ cmsHTRANSFORM CMSEXPORT cmsCreateExtendedTransform(cmsContext ContextID,
if (hGamutProfile == NULL) dwFlags &= ~cmsFLAGS_GAMUTCHECK;
}
- // On floating point transforms, inhibit optimizations
- FloatTransform = (_cmsFormatterIsFloat(InputFormat) && _cmsFormatterIsFloat(OutputFormat));
-
+ // On floating point transforms, inhibit cache
if (_cmsFormatterIsFloat(InputFormat) || _cmsFormatterIsFloat(OutputFormat))
dwFlags |= cmsFLAGS_NOCACHE;