diff options
Diffstat (limited to 'src/cmsplugin.c')
-rw-r--r-- | src/cmsplugin.c | 118 |
1 files changed, 59 insertions, 59 deletions
diff --git a/src/cmsplugin.c b/src/cmsplugin.c index 58ce15d..a74e579 100644 --- a/src/cmsplugin.c +++ b/src/cmsplugin.c @@ -3,22 +3,22 @@ // 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. // //--------------------------------------------------------------------------------- @@ -44,7 +44,7 @@ cmsUInt16Number CMSEXPORT _cmsAdjustEndianess16(cmsUInt16Number Word) tmp = pByte[0]; pByte[0] = pByte[1]; pByte[1] = tmp; -#endif +#endif return Word; } @@ -78,9 +78,9 @@ cmsUInt32Number CMSEXPORT _cmsAdjustEndianess32(cmsUInt32Number DWord) void CMSEXPORT _cmsAdjustEndianess64(cmsUInt64Number* Result, cmsUInt64Number* QWord) { - + #ifndef CMS_USE_BIG_ENDIAN - + cmsUInt8Number* pIn = (cmsUInt8Number*) QWord; cmsUInt8Number* pOut = (cmsUInt8Number*) Result; @@ -91,7 +91,7 @@ void CMSEXPORT _cmsAdjustEndianess64(cmsUInt64Number* Result, cmsUInt64Number* 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]; @@ -110,8 +110,8 @@ cmsBool CMSEXPORT _cmsReadUInt8Number(cmsIOHANDLER* io, cmsUInt8Number* n) _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; @@ -123,8 +123,8 @@ cmsBool CMSEXPORT _cmsReadUInt16Number(cmsIOHANDLER* io, cmsUInt16Number* n) _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; @@ -155,8 +155,8 @@ cmsBool CMSEXPORT _cmsReadUInt32Number(cmsIOHANDLER* io, cmsUInt32Number* n) _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; @@ -168,8 +168,8 @@ cmsBool CMSEXPORT _cmsReadFloat32Number(cmsIOHANDLER* io, cmsFloat32Number* n) _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) { @@ -186,8 +186,8 @@ cmsBool CMSEXPORT _cmsReadUInt64Number(cmsIOHANDLER* io, cmsUInt64Number* n) _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); return TRUE; @@ -200,8 +200,8 @@ cmsBool CMSEXPORT _cmsRead15Fixed16Number(cmsIOHANDLER* io, cmsFloat64Number* n _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)); @@ -250,9 +250,9 @@ cmsBool CMSEXPORT _cmsWriteUInt8Number(cmsIOHANDLER* io, cmsUInt8Number n) { _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; } @@ -263,9 +263,9 @@ cmsBool CMSEXPORT _cmsWriteUInt16Number(cmsIOHANDLER* io, cmsUInt16Number n) _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; } @@ -290,9 +290,9 @@ cmsBool CMSEXPORT _cmsWriteUInt32Number(cmsIOHANDLER* io, cmsUInt32Number n) _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; } @@ -305,9 +305,9 @@ cmsBool CMSEXPORT _cmsWriteFloat32Number(cmsIOHANDLER* io, cmsFloat32Number n) 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; } @@ -318,9 +318,9 @@ cmsBool CMSEXPORT _cmsWriteUInt64Number(cmsIOHANDLER* io, cmsUInt64Number* n) _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; } @@ -331,16 +331,16 @@ cmsBool CMSEXPORT _cmsWrite15Fixed16Number(cmsIOHANDLER* io, cmsFloat64Number n _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); @@ -365,7 +365,7 @@ cmsFloat64Number CMSEXPORT _cms8Fixed8toDouble(cmsUInt16Number fixed8) 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 @@ -386,13 +386,13 @@ cmsFloat64Number CMSEXPORT _cms15Fixed16toDouble(cmsS15Fixed16Number fix32) 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) { @@ -431,7 +431,7 @@ cmsTagTypeSignature CMSEXPORT _cmsReadTypeBase(cmsIOHANDLER* io) _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); @@ -454,7 +454,7 @@ cmsBool CMSEXPORT _cmsReadAlignment(cmsIOHANDLER* io) cmsUInt8Number Buffer[4]; cmsUInt32Number NextAligned, At; cmsUInt32Number BytesToNextAlignedPos; - + _cmsAssert(io != NULL); At = io -> Tell(io); @@ -502,7 +502,7 @@ cmsBool CMSEXPORT _cmsIOPrintf(cmsIOHANDLER* io, const char* frm, ...) if (len < 0) return FALSE; // Truncated, which is a fatal error for us rc = io ->Write(io, len, Buffer); - + va_end(args); return rc; @@ -528,8 +528,8 @@ cmsBool CMSEXPORT cmsPlugin(void* Plug_in) { cmsPluginBase* Plugin; - for (Plugin = (cmsPluginBase*) Plug_in; - Plugin != NULL; + for (Plugin = (cmsPluginBase*) Plug_in; + Plugin != NULL; Plugin = Plugin -> Next) { if (Plugin -> Magic != cmsPluginMagicNumber) { @@ -538,7 +538,7 @@ cmsBool CMSEXPORT cmsPlugin(void* Plug_in) } 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; } @@ -552,11 +552,11 @@ cmsBool CMSEXPORT cmsPlugin(void* Plug_in) case cmsPluginInterpolationSig: if (!_cmsRegisterInterpPlugin(Plugin)) return FALSE; break; - + case cmsPluginTagTypeSig: if (!_cmsRegisterTagTypePlugin(Plugin)) return FALSE; break; - + case cmsPluginTagSig: if (!_cmsRegisterTagPlugin(Plugin)) return FALSE; break; @@ -588,7 +588,7 @@ cmsBool CMSEXPORT cmsPlugin(void* Plug_in) default: cmsSignalError(0, cmsERROR_UNKNOWN_EXTENSION, "Unrecognized plugin type '%X'", Plugin -> Type); return FALSE; - } + } } // Keep a reference to the plug-in |