Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(135)

Side by Side Diff: third_party/lcms2-2.6/src/cmstypes.c

Issue 2545593002: Encode lcms files as utf-8 (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 //------------------------------------------------------------------------------ --- 1 //------------------------------------------------------------------------------ ---
2 // 2 //
3 // Little Color Management System 3 // Little Color Management System
4 // Copyright (c) 1998-2014 Marti Maria Saguer 4 // Copyright (c) 1998-2014 Marti Maria Saguer
5 // 5 //
6 // Permission is hereby granted, free of charge, to any person obtaining 6 // Permission is hereby granted, free of charge, to any person obtaining
7 // a copy of this software and associated documentation files (the "Software"), 7 // a copy of this software and associated documentation files (the "Software"),
8 // to deal in the Software without restriction, including without limitation 8 // to deal in the Software without restriction, including without limitation
9 // the rights to use, copy, modify, merge, publish, distribute, sublicense, 9 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 // and/or sell copies of the Software, and to permit persons to whom the Softwar e 10 // and/or sell copies of the Software, and to permit persons to whom the Softwar e
(...skipping 944 matching lines...) Expand 10 before | Expand all | Expand 10 after
955 cmsBool rc = FALSE; 955 cmsBool rc = FALSE;
956 char Filler[68]; 956 char Filler[68];
957 957
958 // Used below for writting zeroes 958 // Used below for writting zeroes
959 memset(Filler, 0, sizeof(Filler)); 959 memset(Filler, 0, sizeof(Filler));
960 960
961 // Get the len of string 961 // Get the len of string
962 len = cmsMLUgetASCII(mlu, cmsNoLanguage, cmsNoCountry, NULL, 0); 962 len = cmsMLUgetASCII(mlu, cmsNoLanguage, cmsNoCountry, NULL, 0);
963 963
964 // From ICC3.4: It has been found that textDescriptionType can contain misal igned data 964 // From ICC3.4: It has been found that textDescriptionType can contain misal igned data
965 //(see clause 4.1 for the definition of “aligned?. Because the Unicode langu age 965 //(see clause 4.1 for the definition of 'aligned'. Because the Unicode langu age
966 // code and Unicode count immediately follow the ASCII description, their 966 // code and Unicode count immediately follow the ASCII description, their
967 // alignment is not correct if the ASCII count is not a multiple of four. Th e 967 // alignment is not correct if the ASCII count is not a multiple of four. Th e
968 // ScriptCode code is misaligned when the ASCII count is odd. Profile readin g and 968 // ScriptCode code is misaligned when the ASCII count is odd. Profile readin g and
969 // writing software must be written carefully in order to handle these align ment 969 // writing software must be written carefully in order to handle these align ment
970 // problems. 970 // problems.
971 971
972 // Compute an aligned size 972 // Compute an aligned size
973 len_aligned = _cmsALIGNLONG(len); 973 len_aligned = _cmsALIGNLONG(len);
974 len_filler_alignment = len_aligned - len; 974 len_filler_alignment = len_aligned - len;
975 975
(...skipping 2081 matching lines...) Expand 10 before | Expand all | Expand 10 after
3057 } 3057 }
3058 3058
3059 3059
3060 // ***************************************************************************** *** 3060 // ***************************************************************************** ***
3061 // Type cmsSigNamedColor2Type 3061 // Type cmsSigNamedColor2Type
3062 // ***************************************************************************** *** 3062 // ***************************************************************************** ***
3063 // 3063 //
3064 //The namedColor2Type is a count value and array of structures that provide colo r 3064 //The namedColor2Type is a count value and array of structures that provide colo r
3065 //coordinates for 7-bit ASCII color names. For each named color, a PCS and optio nal 3065 //coordinates for 7-bit ASCII color names. For each named color, a PCS and optio nal
3066 //device representation of the color are given. Both representations are 16-bit values. 3066 //device representation of the color are given. Both representations are 16-bit values.
3067 //The device representation corresponds to the header’s “color space of data?fie ld. 3067 //The device representation corresponds to the header's 'color space of data' fi eld.
3068 //This representation should be consistent with the “number of device components ?//field in the namedColor2Type. If this field is 0, device coordinates are not provided. 3068 //This representation should be consistent with the 'number of device components '
3069 //The PCS representation corresponds to the header’s PCS field. The PCS represen tation 3069 //field in the namedColor2Type. If this field is 0, device coordinates are not p rovided.
3070 //The PCS representation corresponds to the header's PCS field. The PCS represen tation
3070 //is always provided. Color names are fixed-length, 32-byte fields including nul l 3071 //is always provided. Color names are fixed-length, 32-byte fields including nul l
3071 //termination. In order to maintain maximum portability, it is strongly recommen ded 3072 //termination. In order to maintain maximum portability, it is strongly recommen ded
3072 //that special characters of the 7-bit ASCII set not be used. 3073 //that special characters of the 7-bit ASCII set not be used.
3073 3074
3074 static 3075 static
3075 void *Type_NamedColor_Read(struct _cms_typehandler_struct* self, cmsIOHANDLER* i o, cmsUInt32Number* nItems, cmsUInt32Number SizeOfTag) 3076 void *Type_NamedColor_Read(struct _cms_typehandler_struct* self, cmsIOHANDLER* i o, cmsUInt32Number* nItems, cmsUInt32Number SizeOfTag)
3076 { 3077 {
3077 3078
3078 cmsUInt32Number vendorFlag; // Bottom 16 bits for ICC use 3079 cmsUInt32Number vendorFlag; // Bottom 16 bits for ICC use
3079 cmsUInt32Number count; // Count of named colors 3080 cmsUInt32Number count; // Count of named colors
(...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after
3802 void Type_Screening_Free(struct _cms_typehandler_struct* self, void* Ptr) 3803 void Type_Screening_Free(struct _cms_typehandler_struct* self, void* Ptr)
3803 { 3804 {
3804 _cmsFree(self ->ContextID, Ptr); 3805 _cmsFree(self ->ContextID, Ptr);
3805 } 3806 }
3806 3807
3807 // ***************************************************************************** *** 3808 // ***************************************************************************** ***
3808 // Type cmsSigViewingConditionsType 3809 // Type cmsSigViewingConditionsType
3809 // ***************************************************************************** *** 3810 // ***************************************************************************** ***
3810 // 3811 //
3811 //This type represents a set of viewing condition parameters including: 3812 //This type represents a set of viewing condition parameters including:
3812 //CIE ’absolute?illuminant white point tristimulus values and CIE ’absolute?//su rround tristimulus values. 3813 //CIE 'absolute'illuminant white point tristimulus values and CIE 'absolute'
3814 //surround tristimulus values.
3813 3815
3814 static 3816 static
3815 void *Type_ViewingConditions_Read(struct _cms_typehandler_struct* self, cmsIOHAN DLER* io, cmsUInt32Number* nItems, cmsUInt32Number SizeOfTag) 3817 void *Type_ViewingConditions_Read(struct _cms_typehandler_struct* self, cmsIOHAN DLER* io, cmsUInt32Number* nItems, cmsUInt32Number SizeOfTag)
3816 { 3818 {
3817 cmsICCViewingConditions* vc = NULL; 3819 cmsICCViewingConditions* vc = NULL;
3818 3820
3819 vc = (cmsICCViewingConditions*) _cmsMallocZero(self ->ContextID, sizeof(cmsI CCViewingConditions)); 3821 vc = (cmsICCViewingConditions*) _cmsMallocZero(self ->ContextID, sizeof(cmsI CCViewingConditions));
3820 if (vc == NULL) return NULL; 3822 if (vc == NULL) return NULL;
3821 3823
3822 *nItems = 0; 3824 *nItems = 0;
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
3888 static 3890 static
3889 void GenericMPEfree(struct _cms_typehandler_struct* self, void *Ptr) 3891 void GenericMPEfree(struct _cms_typehandler_struct* self, void *Ptr)
3890 { 3892 {
3891 cmsStageFree((cmsStage*) Ptr); 3893 cmsStageFree((cmsStage*) Ptr);
3892 return; 3894 return;
3893 3895
3894 cmsUNUSED_PARAMETER(self); 3896 cmsUNUSED_PARAMETER(self);
3895 } 3897 }
3896 3898
3897 // Each curve is stored in one or more curve segments, with break-points specifi ed between curve segments. 3899 // Each curve is stored in one or more curve segments, with break-points specifi ed between curve segments.
3898 // The first curve segment always starts at –Infinity, and the last curve segmen t always ends at +Infinity. The 3900 // The first curve segment always starts at -Infinity, and the last curve segmen t always ends at +Infinity. The
3899 // first and last curve segments shall be specified in terms of a formula, where as the other segments shall be 3901 // first and last curve segments shall be specified in terms of a formula, where as the other segments shall be
3900 // specified either in terms of a formula, or by a sampled curve. 3902 // specified either in terms of a formula, or by a sampled curve.
3901 3903
3902 3904
3903 // Read an embedded segmented curve 3905 // Read an embedded segmented curve
3904 static 3906 static
3905 cmsToneCurve* ReadSegmentedCurve(struct _cms_typehandler_struct* self, cmsIOHAND LER* io) 3907 cmsToneCurve* ReadSegmentedCurve(struct _cms_typehandler_struct* self, cmsIOHAND LER* io)
3906 { 3908 {
3907 cmsCurveSegSignature ElementSig; 3909 cmsCurveSegSignature ElementSig;
3908 cmsUInt32Number i, j; 3910 cmsUInt32Number i, j;
(...skipping 1670 matching lines...) Expand 10 before | Expand all | Expand 10 after
5579 5581
5580 for (pt = SupportedTags; 5582 for (pt = SupportedTags;
5581 pt != NULL; 5583 pt != NULL;
5582 pt = pt ->Next) { 5584 pt = pt ->Next) {
5583 5585
5584 if (sig == pt -> Signature) return &pt ->Descriptor; 5586 if (sig == pt -> Signature) return &pt ->Descriptor;
5585 } 5587 }
5586 5588
5587 return NULL; 5589 return NULL;
5588 } 5590 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698