3 * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
6 * This file is a component of an X Window System-specific implementation
7 * of Xcms based on the TekColor Color Management System. Permission is
8 * hereby granted to use, copy, modify, sell, and otherwise distribute this
9 * software and its documentation for any purpose and without fee, provided
10 * that this copyright, permission, and disclaimer notice is reproduced in
11 * all copies of this software and in supporting documentation. TekColor
12 * is a trademark of Tektronix, Inc.
14 * Tektronix makes no representation about the suitability of this software
15 * for any purpose. It is provided "as is" and with all faults.
17 * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
18 * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
19 * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
20 * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
21 * RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF
22 * CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
23 * CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE.
30 * Source for XcmsFormatOfPrefix()
50 XcmsFormatOfPrefix(char *prefix)
53 * Returns the Color Space ID for the specified prefix
54 * if the color space is found in the Color Conversion
58 * Color Space ID if found; zero otherwise.
61 XcmsColorSpace **papColorSpaces;
67 * While copying prefix to string_lowered, convert to lowercase
69 if ((len = strlen(prefix)) >= sizeof(string_buf)) {
70 string_lowered = (char *) Xmalloc(len+1);
72 string_lowered = string_buf;
74 _XcmsCopyISOLatin1Lowered(string_lowered, prefix);
77 * First try Device-Independent color spaces
79 papColorSpaces = _XcmsDIColorSpaces;
80 if (papColorSpaces != NULL) {
81 while (*papColorSpaces != NULL) {
82 if (strcmp((*papColorSpaces)->prefix, string_lowered) == 0) {
83 if (len >= sizeof(string_buf)) Xfree(string_lowered);
84 return((*papColorSpaces)->id);
91 * Next try Device-Dependent color spaces
93 papColorSpaces = _XcmsDDColorSpaces;
94 if (papColorSpaces != NULL) {
95 while (*papColorSpaces != NULL) {
96 if (strcmp((*papColorSpaces)->prefix, string_lowered) == 0) {
97 if (len >= sizeof(string_buf)) Xfree(string_lowered);
98 return((*papColorSpaces)->id);
104 if (len >= sizeof(string_buf)) Xfree(string_lowered);
105 return(XcmsUndefinedFormat);