aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/lib/src/xcms
diff options
context:
space:
mode:
Diffstat (limited to 'nx-X11/lib/src/xcms')
-rw-r--r--nx-X11/lib/src/xcms/CvCols.c5
-rw-r--r--nx-X11/lib/src/xcms/HVCGcVC.c2
-rw-r--r--nx-X11/lib/src/xcms/HVCMxC.c2
-rw-r--r--nx-X11/lib/src/xcms/LRGB.c8
-rw-r--r--nx-X11/lib/src/xcms/Lab.c2
-rw-r--r--nx-X11/lib/src/xcms/Luv.c2
-rw-r--r--nx-X11/lib/src/xcms/StCols.c5
-rw-r--r--nx-X11/lib/src/xcms/cmsAllNCol.c2
-rw-r--r--nx-X11/lib/src/xcms/cmsColNm.c17
-rw-r--r--nx-X11/lib/src/xcms/cmsInt.c9
-rw-r--r--nx-X11/lib/src/xcms/cmsLkCol.c2
-rw-r--r--nx-X11/lib/src/xcms/xyY.c2
12 files changed, 38 insertions, 20 deletions
diff --git a/nx-X11/lib/src/xcms/CvCols.c b/nx-X11/lib/src/xcms/CvCols.c
index 87d49311c..00bf8b242 100644
--- a/nx-X11/lib/src/xcms/CvCols.c
+++ b/nx-X11/lib/src/xcms/CvCols.c
@@ -39,6 +39,7 @@
#include "Xlibint.h"
#include "Xcmsint.h"
#include "Cv.h"
+#include "reallocarray.h"
/*
* LOCAL DEFINES
@@ -796,7 +797,9 @@ XcmsConvertColors(
* Make copy of array of color specifications
*/
if (nColors > 1) {
- pColors_tmp = Xmalloc(nColors * sizeof(XcmsColor));
+ pColors_tmp = Xmallocarray(nColors, sizeof(XcmsColor));
+ if (pColors_tmp == NULL)
+ return(XcmsFailure);
} else {
pColors_tmp = &Color1;
}
diff --git a/nx-X11/lib/src/xcms/HVCGcVC.c b/nx-X11/lib/src/xcms/HVCGcVC.c
index 7ace5f13f..e9eb3a1e9 100644
--- a/nx-X11/lib/src/xcms/HVCGcVC.c
+++ b/nx-X11/lib/src/xcms/HVCGcVC.c
@@ -170,7 +170,7 @@ XcmsTekHVCClipVC (
}
if (pColor->spec.TekHVC.V < hvc_max.spec.TekHVC.V) {
- /* return the intersection of the perpindicular line through */
+ /* return the intersection of the perpendicular line through */
/* the value and chroma given and the line from 0,0 and hvc_max. */
Chroma = pColor->spec.TekHVC.C;
Value = pColor->spec.TekHVC.V;
diff --git a/nx-X11/lib/src/xcms/HVCMxC.c b/nx-X11/lib/src/xcms/HVCMxC.c
index 074844ccc..3eb0929d9 100644
--- a/nx-X11/lib/src/xcms/HVCMxC.c
+++ b/nx-X11/lib/src/xcms/HVCMxC.c
@@ -39,7 +39,7 @@
* TekHVCMxC.c
*
* DESCRIPTION
- * Source for the XcmsTekHVCQueryMaxC() gamut boudary
+ * Source for the XcmsTekHVCQueryMaxC() gamut boundary
* querying routine.
*
*/
diff --git a/nx-X11/lib/src/xcms/LRGB.c b/nx-X11/lib/src/xcms/LRGB.c
index 4bfa3cfb1..ae42adda9 100644
--- a/nx-X11/lib/src/xcms/LRGB.c
+++ b/nx-X11/lib/src/xcms/LRGB.c
@@ -795,7 +795,7 @@ LINEAR_RGB_InitSCCData(
return(XcmsSuccess);
-FreeBlueTblElements:
+FreeBlueTblElements: _X_UNUSED
Xfree(pScreenData->pBlueTbl->pBase);
FreeBlueTbl:
@@ -1178,7 +1178,7 @@ _XcmsTableSearch(
/*
* DESCRIPTION
- * A binary search through the specificied table.
+ * A binary search through the specified table.
*
* RETURNS
* Returns 0 if failed; otherwise non-zero.
@@ -1293,7 +1293,7 @@ XcmsLRGB_RGB_ParseString(
* Attempt to parse the value portion.
*/
spec++;
- n = strlen(spec);
+ n = (int)strlen(spec);
if (n != 3 && n != 6 && n != 9 && n != 12) {
return(XcmsFailure);
}
@@ -1337,7 +1337,7 @@ XcmsLRGB_RGB_ParseString(
/*
* Check for proper prefix.
*/
- if (strncmp(spec, _XcmsRGB_prefix, n) != 0) {
+ if (strncmp(spec, _XcmsRGB_prefix, (size_t)n) != 0) {
return(XcmsFailure);
}
diff --git a/nx-X11/lib/src/xcms/Lab.c b/nx-X11/lib/src/xcms/Lab.c
index 6f7075643..52daa4e7b 100644
--- a/nx-X11/lib/src/xcms/Lab.c
+++ b/nx-X11/lib/src/xcms/Lab.c
@@ -149,7 +149,7 @@ CIELab_ParseString(
/*
* Check for proper prefix.
*/
- if (strncmp(spec, _XcmsCIELab_prefix, n) != 0) {
+ if (strncmp(spec, _XcmsCIELab_prefix, (size_t)n) != 0) {
return(XcmsFailure);
}
diff --git a/nx-X11/lib/src/xcms/Luv.c b/nx-X11/lib/src/xcms/Luv.c
index 2bce977ea..91d13a054 100644
--- a/nx-X11/lib/src/xcms/Luv.c
+++ b/nx-X11/lib/src/xcms/Luv.c
@@ -152,7 +152,7 @@ CIELuv_ParseString(
/*
* Check for proper prefix.
*/
- if (strncmp(spec, _XcmsCIELuv_prefix, n) != 0) {
+ if (strncmp(spec, _XcmsCIELuv_prefix, (size_t)n) != 0) {
return(XcmsFailure);
}
diff --git a/nx-X11/lib/src/xcms/StCols.c b/nx-X11/lib/src/xcms/StCols.c
index 42a29cd7f..22d6a10bc 100644
--- a/nx-X11/lib/src/xcms/StCols.c
+++ b/nx-X11/lib/src/xcms/StCols.c
@@ -38,6 +38,7 @@
#include "Xlibint.h"
#include "Xcmsint.h"
#include "Cv.h"
+#include "reallocarray.h"
/************************************************************************
@@ -85,7 +86,9 @@ XcmsStoreColors(
* overwrite the contents.
*/
if (nColors > 1) {
- pColors_tmp = Xmalloc(nColors * sizeof(XcmsColor));
+ pColors_tmp = Xmallocarray(nColors, sizeof(XcmsColor));
+ if (pColors_tmp == NULL)
+ return(XcmsFailure);
} else {
pColors_tmp = &Color1;
}
diff --git a/nx-X11/lib/src/xcms/cmsAllNCol.c b/nx-X11/lib/src/xcms/cmsAllNCol.c
index d39de6cbd..ae6827f4c 100644
--- a/nx-X11/lib/src/xcms/cmsAllNCol.c
+++ b/nx-X11/lib/src/xcms/cmsAllNCol.c
@@ -152,7 +152,7 @@ PassToServer:
GetReq(AllocNamedColor, req);
req->cmap = cmap;
- nbytes = req->nbytes = strlen(colorname);
+ nbytes = req->nbytes = (CARD16) strlen(colorname);
req->length += (nbytes + 3) >> 2; /* round up to mult of 4 */
_XSend(dpy, colorname, nbytes);
diff --git a/nx-X11/lib/src/xcms/cmsColNm.c b/nx-X11/lib/src/xcms/cmsColNm.c
index 829749112..e9ca5447b 100644
--- a/nx-X11/lib/src/xcms/cmsColNm.c
+++ b/nx-X11/lib/src/xcms/cmsColNm.c
@@ -210,6 +210,8 @@ _XcmsParseColorString(
*/
if ((len = strlen(color_string)) >= sizeof(string_buf)) {
string_lowered = Xmalloc(len+1);
+ if (string_lowered == NULL)
+ return(XcmsFailure);
} else {
string_lowered = string_buf;
}
@@ -417,8 +419,10 @@ _XcmsLookupColorName(
tmpName = *name;
Retry:
- if ((len = strlen(tmpName)) > 63) {
+ if ((len = (int)strlen(tmpName)) > 63) {
name_lowered = Xmalloc(len+1);
+ if (name_lowered == NULL)
+ return(XcmsFailure);
} else {
name_lowered = name_lowered_64;
}
@@ -505,7 +509,7 @@ RemoveSpaces(
/* REMOVE SPACES */
cptr = pString;
- for (i = strlen(pString); i; i--, cptr++) {
+ for (i = (int)strlen(pString); i; i--, cptr++) {
if (!isspace(*cptr)) {
*pString++ = *cptr;
count++;
@@ -731,7 +735,7 @@ LoadColornameDB(void)
pathname = XCMSDB;
}
- length = strlen(pathname);
+ length = (int)strlen(pathname);
if ((length == 0) || (length >= (BUFSIZ - 5))){
XcmsColorDbState = XcmsDbInitFailure;
return(XcmsFailure);
@@ -759,6 +763,13 @@ LoadColornameDB(void)
strings = Xmalloc(size);
pairs = Xcalloc(nEntries, sizeof(XcmsPair));
+ if (strings == NULL || pairs == NULL) {
+ free(strings);
+ free(pairs);
+ (void) fclose(stream);
+ XcmsColorDbState = XcmsDbInitFailure;
+ return(XcmsFailure);
+ }
ReadColornameDB(stream, pairs, strings);
(void) fclose(stream);
diff --git a/nx-X11/lib/src/xcms/cmsInt.c b/nx-X11/lib/src/xcms/cmsInt.c
index f4aef04ff..059b7d583 100644
--- a/nx-X11/lib/src/xcms/cmsInt.c
+++ b/nx-X11/lib/src/xcms/cmsInt.c
@@ -41,6 +41,7 @@
#include "Xlibint.h"
#include "Xcmsint.h"
#include "Cv.h"
+#include "reallocarray.h"
#ifndef XCMSCOMPPROC
# define XCMSCOMPPROC XcmsTekHVCClipC
@@ -82,7 +83,7 @@ _XcmsCopyPointerArray(
for (tmp = pap, n = 0; *tmp != NULL; tmp++, n++);
n++; /* add 1 to include the NULL pointer */
- if ((newArray = Xmalloc(n * sizeof(XPointer)))) {
+ if ((newArray = Xmallocarray(n, sizeof(XPointer)))) {
memcpy((char *)newArray, (char *)pap,
(unsigned)(n * sizeof(XPointer)));
}
@@ -141,7 +142,7 @@ _XcmsPushPointerArray(
/* add 2: 1 for the new pointer and another for the NULL pointer */
n += 2;
- if ((newArray = Xmalloc(n * sizeof(XPointer)))) {
+ if ((newArray = Xmallocarray(n, sizeof(XPointer)))) {
memcpy((char *)(newArray+1),(char *)pap,
(unsigned)((n-1) * sizeof(XPointer)));
*newArray = p;
@@ -224,7 +225,7 @@ _XcmsFreeDefaultCCCs(
/*
* DESCRIPTION
* This routine frees the default XcmsCCC's associated with
- * each screen and its associated substructures as neccessary.
+ * each screen and its associated substructures as necessary.
*
* RETURNS
* void
@@ -296,7 +297,7 @@ _XcmsInitScrnInfo(
/*
* Check if the XcmsCCC's for each screen has been created.
- * Really dont need to be created until some routine uses the Xcms
+ * Really don't need to be created until some routine uses the Xcms
* API routines.
*/
if ((XcmsCCC)dpy->cms.defaultCCCs == NULL) {
diff --git a/nx-X11/lib/src/xcms/cmsLkCol.c b/nx-X11/lib/src/xcms/cmsLkCol.c
index a81c4cbf0..e93a9738b 100644
--- a/nx-X11/lib/src/xcms/cmsLkCol.c
+++ b/nx-X11/lib/src/xcms/cmsLkCol.c
@@ -150,7 +150,7 @@ PassToServer:
LockDisplay(dpy);
GetReq (LookupColor, req);
req->cmap = cmap;
- req->nbytes = n = strlen(colorname);
+ req->nbytes = (CARD16)(n = (int)strlen(colorname));
req->length += (n + 3) >> 2;
Data (dpy, colorname, (long)n);
if (!_XReply (dpy, (xReply *) &reply, 0, xTrue)) {
diff --git a/nx-X11/lib/src/xcms/xyY.c b/nx-X11/lib/src/xcms/xyY.c
index e85b8d249..a99d03849 100644
--- a/nx-X11/lib/src/xcms/xyY.c
+++ b/nx-X11/lib/src/xcms/xyY.c
@@ -145,7 +145,7 @@ CIExyY_ParseString(
/*
* Check for proper prefix.
*/
- if (strncmp(spec, _XcmsCIExyY_prefix, n) != 0) {
+ if (strncmp(spec, _XcmsCIExyY_prefix, (size_t)n) != 0) {
return(XcmsFailure);
}