diff options
author | Marti Maria <info@littlecms.com> | 2010-08-14 18:49:47 +0200 |
---|---|---|
committer | Marti Maria <info@littlecms.com> | 2010-08-14 18:49:47 +0200 |
commit | 60b8b17bd7a9b77e00528c623f6f95a3541be649 (patch) | |
tree | 5636b7fe63c2d0dc32cde6c205832897963f9845 | |
parent | e53c88b8f0fda2e11be191bf9a207b2ed141df30 (diff) | |
download | lcms2-60b8b17bd7a9b77e00528c623f6f95a3541be649.tar.gz |
Fixed a bug in psid and profile sequence tag
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | include/lcms2_plugin.h | 3 | ||||
-rw-r--r-- | src/cmsio0.c | 25 | ||||
-rw-r--r-- | src/cmstypes.c | 25 | ||||
-rw-r--r-- | testbed/testcms2.c | 5 | ||||
-rw-r--r-- | utils/linkicc/linkicc.c | 3 |
6 files changed, 50 insertions, 14 deletions
@@ -13,4 +13,5 @@ Added cmsTagLinkedTo Fixed some typos in error messages Peliminary Delphi wrapper Fixed a bug in tificc in floating point formats -Fixed a bug in device link creation on v4 profiles
\ No newline at end of file +Fixed a bug in device link creation on v4 profiles +Fixed a bug in psid and profile sequence tags
\ No newline at end of file diff --git a/include/lcms2_plugin.h b/include/lcms2_plugin.h index fd90350..359bf0f 100644 --- a/include/lcms2_plugin.h +++ b/include/lcms2_plugin.h @@ -385,8 +385,9 @@ typedef struct _cms_typehandler_struct { void (* FreePtr)(struct _cms_typehandler_struct* self, void *Ptr); - // The calling thread + // Additional parameters used by the calling thread cmsContext ContextID; + cmsUInt32Number ICCVersion; } cmsTagTypeHandler; diff --git a/src/cmsio0.c b/src/cmsio0.c index 2578202..2baa2cc 100644 --- a/src/cmsio0.c +++ b/src/cmsio0.c @@ -1113,6 +1113,8 @@ cmsBool SaveTags(_cmsICCPROFILE* Icc, _cmsICCPROFILE* FileOrig) if (!_cmsWriteTypeBase(io, TypeBase)) return FALSE; + TypeHandler ->ContextID = Icc ->ContextID; + TypeHandler ->ICCVersion = Icc ->Version; if (!TypeHandler ->WritePtr(TypeHandler, io, Data, TagDescriptor ->ElemCount)) { char String[5]; @@ -1288,8 +1290,12 @@ cmsBool CMSEXPORT cmsCloseProfile(cmsHPROFILE hProfile) cmsTagTypeHandler* TypeHandler = Icc ->TagTypeHandlers[i]; - if (TypeHandler != NULL) + if (TypeHandler != NULL) { + + TypeHandler ->ContextID = Icc ->ContextID; // As an additional parameters + TypeHandler ->ICCVersion = Icc ->Version; TypeHandler ->FreePtr(TypeHandler, Icc -> TagPtrs[i]); + } else _cmsFree(Icc ->ContextID, Icc ->TagPtrs[i]); } @@ -1377,6 +1383,9 @@ void* CMSEXPORT cmsReadTag(cmsHPROFILE hProfile, cmsTagSignature sig) // Read the tag Icc -> TagTypeHandlers[n] = TypeHandler; + + TypeHandler ->ContextID = Icc ->ContextID; + TypeHandler ->ICCVersion = Icc ->Version; Icc -> TagPtrs[n] = TypeHandler ->ReadPtr(TypeHandler, io, &ElemCount, TagSize); // The tag type is supported, but something wrong happend and we cannot read the tag. @@ -1453,10 +1462,16 @@ cmsBool CMSEXPORT cmsWriteTag(cmsHPROFILE hProfile, cmsTagSignature sig, const v } else { TypeHandler = Icc ->TagTypeHandlers[i]; + + if (TypeHandler != NULL) { + + TypeHandler ->ContextID = Icc ->ContextID; // As an additional parameter + TypeHandler ->ICCVersion = Icc ->Version; TypeHandler->FreePtr(TypeHandler, Icc -> TagPtrs[i]); } } } + } else { // New one i = Icc -> TagCount; @@ -1485,6 +1500,7 @@ cmsBool CMSEXPORT cmsWriteTag(cmsHPROFILE hProfile, cmsTagSignature sig, const v // Now we need to know which type to use. It depends on the version. Version = cmsGetProfileVersion(hProfile); + if (TagDescriptor ->DecideType != NULL) { // Let the tag descriptor to decide the type base on depending on @@ -1496,6 +1512,7 @@ cmsBool CMSEXPORT cmsWriteTag(cmsHPROFILE hProfile, cmsTagSignature sig, const v } else { + Type = TagDescriptor ->SupportedTypes[0]; } @@ -1512,11 +1529,15 @@ cmsBool CMSEXPORT cmsWriteTag(cmsHPROFILE hProfile, cmsTagSignature sig, const v return FALSE; // Should never happen } + // Fill fields on icc structure Icc ->TagTypeHandlers[i] = TypeHandler; Icc ->TagNames[i] = sig; Icc ->TagSizes[i] = 0; Icc ->TagOffsets[i] = 0; + + TypeHandler ->ContextID = Icc ->ContextID; + TypeHandler ->ICCVersion = Icc ->Version; Icc ->TagPtrs[i] = TypeHandler ->DupPtr(TypeHandler, data, TagDescriptor ->ElemCount); if (Icc ->TagPtrs[i] == NULL) { @@ -1607,6 +1628,8 @@ cmsInt32Number CMSEXPORT cmsReadRawTag(cmsHPROFILE hProfile, cmsTagSignature sig TagDescriptor = _cmsGetTagDescriptor(sig); // Serialize + TypeHandler ->ContextID = Icc ->ContextID; + TypeHandler ->ICCVersion = Icc ->Version; if (!TypeHandler ->WritePtr(TypeHandler, MemIO, Object, TagDescriptor ->ElemCount)) return 0; // Get Size and close diff --git a/src/cmstypes.c b/src/cmstypes.c index 1311256..72c7125 100644 --- a/src/cmstypes.c +++ b/src/cmstypes.c @@ -1477,6 +1477,14 @@ cmsBool Type_MLU_Write(struct _cms_typehandler_struct* self, cmsIOHANDLER* io, cmsUInt32Number Len, Offset; int i; + if (Ptr == NULL) { + + // Empty placeholder + if (!_cmsWriteUInt32Number(io, 0)) return FALSE; + if (!_cmsWriteUInt32Number(io, 12)) return FALSE; + return TRUE; + } + if (!_cmsWriteUInt32Number(io, mlu ->UsedEntries)) return FALSE; if (!_cmsWriteUInt32Number(io, 12)) return FALSE; @@ -3092,6 +3100,13 @@ void Type_NamedColor_Free(struct _cms_typehandler_struct* self, void* Ptr) // Type cmsSigProfileSequenceDescType // ******************************************************************************** +// This type is an array of structures, each of which contains information from the +// header fields and tags from the original profiles which were combined to create +// the final profile. The order of the structures is the order in which the profiles +// were combined and includes a structure for the final profile. This provides a +// description of the profile sequence from source to destination, +// typically used with the DeviceLink profile. + static cmsBool ReadEmbeddedText(struct _cms_typehandler_struct* self, cmsIOHANDLER* io, cmsMLU** mlu, cmsUInt32Number SizeOfTag) { @@ -3171,18 +3186,12 @@ void *Type_ProfileSequenceDesc_Read(struct _cms_typehandler_struct* self, cmsIOH // Aux--Embed a text description type. It can be of type text description or multilocalized unicode +// and it depends of the version number passed on cmsTagDescriptor structure instead of stack static cmsBool SaveDescription(struct _cms_typehandler_struct* self, cmsIOHANDLER* io, cmsMLU* Text) { - if (Text == NULL) { + if (self ->ICCVersion < 0x4000000) { - // Placeholder for a null entry - if (!_cmsWriteTypeBase(io, cmsSigTextDescriptionType)) return FALSE; - return Type_Text_Description_Write(self, io, NULL, 1); - - } - - if (Text->UsedEntries <= 1) { if (!_cmsWriteTypeBase(io, cmsSigTextDescriptionType)) return FALSE; return Type_Text_Description_Write(self, io, Text, 1); } diff --git a/testbed/testcms2.c b/testbed/testcms2.c index d18e67b..1fff6c0 100644 --- a/testbed/testcms2.c +++ b/testbed/testcms2.c @@ -4827,6 +4827,7 @@ cmsInt32Number CheckProfileCreation(void) h = cmsCreateProfilePlaceholder(DbgThread()); if (h == NULL) return 0; + cmsSetProfileVersion(h, 4.2); if (cmsGetTagCount(h) != 0) { Fail("Empty profile with nonzero number of tags"); return 0; } if (cmsIsTag(h, cmsSigAToB0Tag)) { Fail("Found a tag in an empty profile"); return 0; } @@ -7373,8 +7374,6 @@ int main(int argc, char* argv[]) PrintSupportedIntents(); - CheckRGBPrimaries(); - // Create utility profiles Check("Creation of test profiles", CreateTestProfiles); @@ -7561,3 +7560,5 @@ int main(int argc, char* argv[]) return TotalFail; } + + diff --git a/utils/linkicc/linkicc.c b/utils/linkicc/linkicc.c index f887272..c8760a2 100644 --- a/utils/linkicc/linkicc.c +++ b/utils/linkicc/linkicc.c @@ -294,7 +294,8 @@ int main(int argc, char *argv[]) // Ink limiting if (InkLimit != 400.0) { - Profiles[nargs++] = cmsCreateInkLimitingDeviceLink(cmsGetColorSpace(Profiles[nargs-1]), InkLimit); + cmsColorSpaceSignature EndingColorSpace = cmsGetColorSpace(Profiles[nargs-1]); + Profiles[nargs++] = cmsCreateInkLimitingDeviceLink(EndingColorSpace, InkLimit); } // Set the flags |