aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/lib/X11/cmsColNm.c
diff options
context:
space:
mode:
Diffstat (limited to 'nx-X11/lib/X11/cmsColNm.c')
-rw-r--r--nx-X11/lib/X11/cmsColNm.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/nx-X11/lib/X11/cmsColNm.c b/nx-X11/lib/X11/cmsColNm.c
index 1beaf2b88..82ffab5f6 100644
--- a/nx-X11/lib/X11/cmsColNm.c
+++ b/nx-X11/lib/X11/cmsColNm.c
@@ -2,7 +2,7 @@
/*
* Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
* All Rights Reserved
- *
+ *
* This file is a component of an X Window System-specific implementation
* of Xcms based on the TekColor Color Management System. Permission is
* hereby granted to use, copy, modify, sell, and otherwise distribute this
@@ -10,10 +10,10 @@
* that this copyright, permission, and disclaimer notice is reproduced in
* all copies of this software and in supporting documentation. TekColor
* is a trademark of Tektronix, Inc.
- *
+ *
* Tektronix makes no representation about the suitability of this software
* for any purpose. It is provided "as is" and with all faults.
- *
+ *
* TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
* INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
@@ -184,7 +184,7 @@ _XcmsParseColorString(
* DESCRIPTION
* Assuming color_string contains a numerical string color
* specification, attempts to parse a string into an
- * XcmsColor structure.
+ * XcmsColor structure.
*
* RETURNS
* 0 if failed; otherwise non-zero.
@@ -467,7 +467,7 @@ Retry:
pair->flag = CYCLE;
return(XcmsFailure);
}
-
+
if (_XcmsParseColorString(ccc, pair->second, pColor) == XcmsSuccess) {
/* f2 contains a numerical string specification */
return(XcmsSuccess);
@@ -706,7 +706,7 @@ LoadColornameDB(void)
{
int size;
FILE *stream;
- char *pathname;
+ const char *pathname;
struct stat txt;
int length;
@@ -732,10 +732,17 @@ LoadColornameDB(void)
}
if ((stream = _XFopenFile (pathname, "r")) == NULL) {
+ /* can't open file */
+ XcmsColorDbState = XcmsDbInitFailure;
return(XcmsFailure);
}
- stringSectionSize(stream, &nEntries, &size);
+ if (stringSectionSize(stream, &nEntries, &size) != XcmsSuccess ||
+ nEntries == 0) {
+ (void) fclose(stream);
+ XcmsColorDbState = XcmsDbInitFailure;
+ return(XcmsFailure);
+ }
rewind(stream);
strings = (char *) Xmalloc(size);
@@ -806,7 +813,7 @@ _XcmsCopyISOLatin1Lowered(
/*
* NAME
- * _XcmsResolveColorString -
+ * _XcmsResolveColorString -
*
* SYNOPSIS
*/
@@ -862,7 +869,7 @@ _XcmsResolveColorString (
if (result_format != XcmsUndefinedFormat
&& pColor_exact_return->format != result_format) {
/* need to be converted to the target format */
- return(XcmsConvertColors(ccc, pColor_exact_return, 1,
+ return(XcmsConvertColors(ccc, pColor_exact_return, 1,
result_format, (Bool *)NULL));
} else {
return(XcmsSuccess);