// Little Color Management System
// Copyright (c) 1998-2010 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,
-// and/or sell copies of the Software, and to permit persons to whom the Software
+// 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,
+// and/or sell copies of the Software, and to permit persons to whom the Software
// is furnished to do so, subject to the following conditions:
//
-// The above copyright notice and this permission notice shall be included in
+// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
-// THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
+// THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//---------------------------------------------------------------------------------
tmp = pByte[0];
pByte[0] = pByte[1];
pByte[1] = tmp;
-#endif
+#endif
return Word;
}
// 1 2 3 4 5 6 7 8
// 8 7 6 5 4 3 2 1
-void CMSEXPORT _cmsAdjustEndianess64(cmsUInt64Number* Result, cmsUInt64Number QWord)
+void CMSEXPORT _cmsAdjustEndianess64(cmsUInt64Number* Result, cmsUInt64Number* QWord)
{
-
+
#ifndef CMS_USE_BIG_ENDIAN
-
- cmsUInt8Number* pIn = (cmsUInt8Number*) &QWord;
+
+ cmsUInt8Number* pIn = (cmsUInt8Number*) QWord;
cmsUInt8Number* pOut = (cmsUInt8Number*) Result;
_cmsAssert(Result != NULL);
pOut[5] = pIn[2];
pOut[4] = pIn[3];
pOut[3] = pIn[4];
- pOut[2] = pIn[5];
+ pOut[2] = pIn[5];
pOut[1] = pIn[6];
pOut[0] = pIn[7];
_cmsAssert(Result != NULL);
- *Result = QWord;
+ *Result = *QWord;
#endif
}
_cmsAssert(io != NULL);
- if (io -> Read(io, &tmp, sizeof(cmsUInt8Number), 1) != 1)
- return FALSE;
+ if (io -> Read(io, &tmp, sizeof(cmsUInt8Number), 1) != 1)
+ return FALSE;
if (n != NULL) *n = tmp;
return TRUE;
_cmsAssert(io != NULL);
- if (io -> Read(io, &tmp, sizeof(cmsUInt16Number), 1) != 1)
- return FALSE;
+ if (io -> Read(io, &tmp, sizeof(cmsUInt16Number), 1) != 1)
+ return FALSE;
if (n != NULL) *n = _cmsAdjustEndianess16(tmp);
return TRUE;
_cmsAssert(io != NULL);
- if (io -> Read(io, &tmp, sizeof(cmsUInt32Number), 1) != 1)
- return FALSE;
+ if (io -> Read(io, &tmp, sizeof(cmsUInt32Number), 1) != 1)
+ return FALSE;
if (n != NULL) *n = _cmsAdjustEndianess32(tmp);
return TRUE;
_cmsAssert(io != NULL);
- if (io -> Read(io, &tmp, sizeof(cmsFloat32Number), 1) != 1)
- return FALSE;
+ if (io -> Read(io, &tmp, sizeof(cmsFloat32Number), 1) != 1)
+ return FALSE;
if (n != NULL) {
_cmsAssert(io != NULL);
- if (io -> Read(io, &tmp, sizeof(cmsUInt64Number), 1) != 1)
- return FALSE;
+ if (io -> Read(io, &tmp, sizeof(cmsUInt64Number), 1) != 1)
+ return FALSE;
- if (n != NULL) _cmsAdjustEndianess64(n, tmp);
+ if (n != NULL) _cmsAdjustEndianess64(n, &tmp);
return TRUE;
}
_cmsAssert(io != NULL);
- if (io -> Read(io, &tmp, sizeof(cmsUInt32Number), 1) != 1)
- return FALSE;
+ if (io -> Read(io, &tmp, sizeof(cmsUInt32Number), 1) != 1)
+ return FALSE;
if (n != NULL) {
*n = _cms15Fixed16toDouble(_cmsAdjustEndianess32(tmp));
{
_cmsAssert(io != NULL);
- if (io -> Write(io, sizeof(cmsUInt8Number), &n) != 1)
- return FALSE;
-
+ if (io -> Write(io, sizeof(cmsUInt8Number), &n) != 1)
+ return FALSE;
+
return TRUE;
}
_cmsAssert(io != NULL);
tmp = _cmsAdjustEndianess16(n);
- if (io -> Write(io, sizeof(cmsUInt16Number), &tmp) != 1)
- return FALSE;
-
+ if (io -> Write(io, sizeof(cmsUInt16Number), &tmp) != 1)
+ return FALSE;
+
return TRUE;
}
_cmsAssert(io != NULL);
tmp = _cmsAdjustEndianess32(n);
- if (io -> Write(io, sizeof(cmsUInt32Number), &tmp) != 1)
- return FALSE;
-
+ if (io -> Write(io, sizeof(cmsUInt32Number), &tmp) != 1)
+ return FALSE;
+
return TRUE;
}
tmp = *(cmsUInt32Number*) &n;
tmp = _cmsAdjustEndianess32(tmp);
- if (io -> Write(io, sizeof(cmsUInt32Number), &tmp) != 1)
- return FALSE;
-
+ if (io -> Write(io, sizeof(cmsUInt32Number), &tmp) != 1)
+ return FALSE;
+
return TRUE;
}
-cmsBool CMSEXPORT _cmsWriteUInt64Number(cmsIOHANDLER* io, cmsUInt64Number n)
+cmsBool CMSEXPORT _cmsWriteUInt64Number(cmsIOHANDLER* io, cmsUInt64Number* n)
{
cmsUInt64Number tmp;
_cmsAssert(io != NULL);
_cmsAdjustEndianess64(&tmp, n);
- if (io -> Write(io, sizeof(cmsUInt64Number), &tmp) != 1)
- return FALSE;
-
+ if (io -> Write(io, sizeof(cmsUInt64Number), &tmp) != 1)
+ return FALSE;
+
return TRUE;
}
_cmsAssert(io != NULL);
tmp = _cmsAdjustEndianess32(_cmsDoubleTo15Fixed16(n));
- if (io -> Write(io, sizeof(cmsUInt32Number), &tmp) != 1)
- return FALSE;
-
+ if (io -> Write(io, sizeof(cmsUInt32Number), &tmp) != 1)
+ return FALSE;
+
return TRUE;
}
cmsBool CMSEXPORT _cmsWriteXYZNumber(cmsIOHANDLER* io, const cmsCIEXYZ* XYZ)
{
cmsEncodedXYZNumber xyz;
-
+
_cmsAssert(io != NULL);
_cmsAssert(XYZ != NULL);
cmsUInt16Number CMSEXPORT _cmsDoubleTo8Fixed8(cmsFloat64Number val)
{
cmsS15Fixed16Number GammaFixed32 = _cmsDoubleTo15Fixed16(val);
- return (cmsUInt16Number) ((GammaFixed32 >> 8) & 0xFFFF);
+ return (cmsUInt16Number) ((GammaFixed32 >> 8) & 0xFFFF);
}
// from Fixed point 15.16 to double
return sign * floater;
}
-// from double to Fixed point 15.16
+// from double to Fixed point 15.16
cmsS15Fixed16Number CMSEXPORT _cmsDoubleTo15Fixed16(cmsFloat64Number v)
{
return ((cmsS15Fixed16Number) floor((v)*65536.0 + 0.5));
}
-// Date/Time functions
+// Date/Time functions
void CMSEXPORT _cmsDecodeDateTimeNumber(const cmsDateTimeNumber *Source, struct tm *Dest)
{
_cmsAssert(io != NULL);
- if (io -> Read(io, &Base, sizeof(_cmsTagBase), 1) != 1)
+ if (io -> Read(io, &Base, sizeof(_cmsTagBase), 1) != 1)
return (cmsTagTypeSignature) 0;
return (cmsTagTypeSignature) _cmsAdjustEndianess32(Base.sig);
cmsUInt8Number Buffer[4];
cmsUInt32Number NextAligned, At;
cmsUInt32Number BytesToNextAlignedPos;
-
+
_cmsAssert(io != NULL);
At = io -> Tell(io);
if (len < 0) return FALSE; // Truncated, which is a fatal error for us
rc = io ->Write(io, len, Buffer);
-
+
va_end(args);
return rc;
{
cmsPluginBase* Plugin;
- for (Plugin = (cmsPluginBase*) Plug_in;
- Plugin != NULL;
+ for (Plugin = (cmsPluginBase*) Plug_in;
+ Plugin != NULL;
Plugin = Plugin -> Next) {
if (Plugin -> Magic != cmsPluginMagicNumber) {
}
if (Plugin ->ExpectedVersion > LCMS_VERSION) {
- cmsSignalError(0, cmsERROR_UNKNOWN_EXTENSION, "plugin needs Little CMS %d, current version is %d",
+ cmsSignalError(0, cmsERROR_UNKNOWN_EXTENSION, "plugin needs Little CMS %d, current version is %d",
Plugin ->ExpectedVersion, LCMS_VERSION);
return FALSE;
}
case cmsPluginInterpolationSig:
if (!_cmsRegisterInterpPlugin(Plugin)) return FALSE;
break;
-
+
case cmsPluginTagTypeSig:
if (!_cmsRegisterTagTypePlugin(Plugin)) return FALSE;
break;
-
+
case cmsPluginTagSig:
if (!_cmsRegisterTagPlugin(Plugin)) return FALSE;
break;
if (!_cmsRegisterOptimizationPlugin(Plugin)) return FALSE;
break;
+ case cmsPluginTransformSig:
+ if (!_cmsRegisterTransformPlugin(Plugin)) return FALSE;
+ break;
+
default:
cmsSignalError(0, cmsERROR_UNKNOWN_EXTENSION, "Unrecognized plugin type '%X'", Plugin -> Type);
return FALSE;
- }
+ }
}
// Keep a reference to the plug-in
_cmsRegisterParametricCurvesPlugin(NULL);
_cmsRegisterMultiProcessElementPlugin(NULL);
_cmsRegisterOptimizationPlugin(NULL);
+ _cmsRegisterTransformPlugin(NULL);
if (PluginPool != NULL)
_cmsSubAllocDestroy(PluginPool);