static cmsBool SetSeqDescTag(cmsHPROFILE hProfile, const char* Model) { cmsBool rc = FALSE; cmsContext ContextID = cmsGetProfileContextID(hProfile); cmsSEQ* Seq = cmsAllocProfileSequenceDescription(ContextID, 1); if (Seq == NULL) return FALSE; Seq->seq[0].deviceMfg = (cmsSignature) 0; Seq->seq[0].deviceModel = (cmsSignature) 0; #ifdef CMS_DONT_USE_INT64 Seq->seq[0].attributes[0] = 0; Seq->seq[0].attributes[1] = 0; #else Seq->seq[0].attributes = 0; #endif Seq->seq[0].technology = (cmsTechnologySignature) 0; cmsMLUsetASCII( Seq->seq[0].Manufacturer, cmsNoLanguage, cmsNoCountry, "Little CMS"); cmsMLUsetASCII( Seq->seq[0].Model, cmsNoLanguage, cmsNoCountry, Model); if (!_cmsWriteProfileSequence(hProfile, Seq)) goto Error; rc = TRUE; Error: if (Seq) cmsFreeProfileSequenceDescription(Seq); return rc; }
// Get rid of transform resources void CMSEXPORT cmsDeleteTransform(cmsHTRANSFORM hTransform) { _cmsTRANSFORM* p = (_cmsTRANSFORM*) hTransform; _cmsAssert(p != NULL); if (p -> GamutCheck) cmsPipelineFree(p -> GamutCheck); if (p -> Lut) cmsPipelineFree(p -> Lut); if (p ->InputColorant) cmsFreeNamedColorList(p ->InputColorant); if (p -> OutputColorant) cmsFreeNamedColorList(p ->OutputColorant); if (p ->Sequence) cmsFreeProfileSequenceDescription(p ->Sequence); if (p ->UserData) p ->FreeUserData(p ->ContextID, p ->UserData); _cmsFree(p ->ContextID, (void *) p); }
cmsSEQ* CMSEXPORT cmsDupProfileSequenceDescription(const cmsSEQ* pseq) { cmsSEQ *NewSeq; cmsUInt32Number i; if (pseq == NULL) return NULL; NewSeq = (cmsSEQ*) _cmsMalloc(pseq -> ContextID, sizeof(cmsSEQ)); if (NewSeq == NULL) return NULL; NewSeq -> seq = (cmsPSEQDESC*) _cmsCalloc(pseq ->ContextID, pseq ->n, sizeof(cmsPSEQDESC)); if (NewSeq ->seq == NULL) goto Error; NewSeq -> ContextID = pseq ->ContextID; NewSeq -> n = pseq ->n; for (i=0; i < pseq->n; i++) { memmove(&NewSeq ->seq[i].attributes, &pseq ->seq[i].attributes, sizeof(cmsUInt64Number)); NewSeq ->seq[i].deviceMfg = pseq ->seq[i].deviceMfg; NewSeq ->seq[i].deviceModel = pseq ->seq[i].deviceModel; memmove(&NewSeq ->seq[i].ProfileID, &pseq ->seq[i].ProfileID, sizeof(cmsProfileID)); NewSeq ->seq[i].technology = pseq ->seq[i].technology; NewSeq ->seq[i].Manufacturer = cmsMLUdup(pseq ->seq[i].Manufacturer); NewSeq ->seq[i].Model = cmsMLUdup(pseq ->seq[i].Model); NewSeq ->seq[i].Description = cmsMLUdup(pseq ->seq[i].Description); } return NewSeq; Error: cmsFreeProfileSequenceDescription(NewSeq); return NULL; }