< prev index next >
src/java.desktop/share/native/liblcms/cmslut.c
Print this page
@@ -28,11 +28,11 @@
// file:
//
//---------------------------------------------------------------------------------
//
// Little Color Management System
-// Copyright (c) 1998-2017 Marti Maria Saguer
+// Copyright (c) 1998-2020 Marti Maria Saguer
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
@@ -424,41 +424,35 @@
EvaluateMatrix, MatrixElemDup, MatrixElemTypeFree, NULL );
if (NewMPE == NULL) return NULL;
NewElem = (_cmsStageMatrixData*) _cmsMallocZero(ContextID, sizeof(_cmsStageMatrixData));
- if (NewElem == NULL) return NULL;
-
+ if (NewElem == NULL) goto Error;
+ NewMPE->Data = (void*)NewElem;
NewElem ->Double = (cmsFloat64Number*) _cmsCalloc(ContextID, n, sizeof(cmsFloat64Number));
-
- if (NewElem->Double == NULL) {
- MatrixElemTypeFree(NewMPE);
- return NULL;
- }
+ if (NewElem->Double == NULL) goto Error;
for (i=0; i < n; i++) {
NewElem ->Double[i] = Matrix[i];
}
-
if (Offset != NULL) {
NewElem ->Offset = (cmsFloat64Number*) _cmsCalloc(ContextID, Rows, sizeof(cmsFloat64Number));
- if (NewElem->Offset == NULL) {
- MatrixElemTypeFree(NewMPE);
- return NULL;
- }
+ if (NewElem->Offset == NULL) goto Error;
for (i=0; i < Rows; i++) {
NewElem ->Offset[i] = Offset[i];
}
-
}
- NewMPE ->Data = (void*) NewElem;
return NewMPE;
+
+Error:
+ cmsStageFree(NewMPE);
+ return NULL;
}
// *************************************************************************************************
// Type cmsSigCLutElemType
@@ -727,11 +721,11 @@
return NewMPE;
}
static
-int IdentitySampler(register const cmsUInt16Number In[], register cmsUInt16Number Out[], register void * Cargo)
+int IdentitySampler(CMSREGISTER const cmsUInt16Number In[], CMSREGISTER cmsUInt16Number Out[], CMSREGISTER void * Cargo)
{
int nChan = *(int*) Cargo;
int i;
for (i=0; i < nChan; i++)
@@ -1344,11 +1338,11 @@
}
// Default to evaluate the LUT on 16 bit-basis. Precision is retained.
static
-void _LUTeval16(register const cmsUInt16Number In[], register cmsUInt16Number Out[], register const void* D)
+void _LUTeval16(CMSREGISTER const cmsUInt16Number In[], CMSREGISTER cmsUInt16Number Out[], CMSREGISTER const void* D)
{
cmsPipeline* lut = (cmsPipeline*) D;
cmsStage *mpe;
cmsFloat32Number Storage[2][MAX_STAGE_CHANNELS];
int Phase = 0, NextPhase;
@@ -1370,11 +1364,11 @@
// Does evaluate the LUT on cmsFloat32Number-basis.
static
-void _LUTevalFloat(register const cmsFloat32Number In[], register cmsFloat32Number Out[], const void* D)
+void _LUTevalFloat(CMSREGISTER const cmsFloat32Number In[], CMSREGISTER cmsFloat32Number Out[], const void* D)
{
cmsPipeline* lut = (cmsPipeline*) D;
cmsStage *mpe;
cmsFloat32Number Storage[2][MAX_STAGE_CHANNELS];
int Phase = 0, NextPhase;
< prev index next >