summaryrefslogtreecommitdiff
path: root/thirdparty/liblcms2/src/cmscgats.c
diff options
context:
space:
mode:
Diffstat (limited to 'thirdparty/liblcms2/src/cmscgats.c')
-rw-r--r--thirdparty/liblcms2/src/cmscgats.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/thirdparty/liblcms2/src/cmscgats.c b/thirdparty/liblcms2/src/cmscgats.c
index 099b07bb..591e4caa 100644
--- a/thirdparty/liblcms2/src/cmscgats.c
+++ b/thirdparty/liblcms2/src/cmscgats.c
@@ -1,7 +1,7 @@
//---------------------------------------------------------------------------------
//
// Little Color Management System
-// Copyright (c) 1998-2012 Marti Maria Saguer
+// Copyright (c) 1998-2016 Marti Maria Saguer
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the "Software"),
@@ -48,7 +48,7 @@
// Symbols
typedef enum {
- SNONE,
+ SUNDEFINED,
SINUM, // Integer
SDNUM, // Real
SIDENT, // Identifier
@@ -324,7 +324,7 @@ static const char* PredefinedSampleID[] = {
"XYZ_X", // X component of tristimulus data
"XYZ_Y", // Y component of tristimulus data
"XYZ_Z", // Z component of tristimulus data
- "XYY_X" // x component of chromaticity data
+ "XYY_X", // x component of chromaticity data
"XYY_Y", // y component of chromaticity data
"XYY_CAPY", // Y component of tristimulus data
"LAB_L", // L* component of Lab data
@@ -521,7 +521,7 @@ SYMBOL BinSrchKey(const char *id)
else l = x + 1;
}
- return SNONE;
+ return SUNDEFINED;
}
@@ -706,7 +706,7 @@ void InSymbol(cmsIT8* it8)
key = BinSrchKey(it8->id);
- if (key == SNONE) it8->sy = SIDENT;
+ if (key == SUNDEFINED) it8->sy = SIDENT;
else it8->sy = key;
}
@@ -801,11 +801,11 @@ void InSymbol(cmsIT8* it8)
if (it8 ->sy == SINUM) {
- sprintf(it8->id, "%d", it8->inum);
+ snprintf(it8->id, 127, "%d", it8->inum);
}
else {
- sprintf(it8->id, it8 ->DoubleFormatter, it8->dnum);
+ snprintf(it8->id, 127, it8 ->DoubleFormatter, it8->dnum);
}
k = (int) strlen(it8 ->id);
@@ -1297,7 +1297,7 @@ cmsHANDLE CMSEXPORT cmsIT8Alloc(cmsContext ContextID)
it8->ValidKeywords = NULL;
it8->ValidSampleID = NULL;
- it8 -> sy = SNONE;
+ it8 -> sy = SUNDEFINED;
it8 -> ch = ' ';
it8 -> Source = NULL;
it8 -> inum = 0;
@@ -1363,7 +1363,7 @@ cmsBool CMSEXPORT cmsIT8SetPropertyDbl(cmsHANDLE hIT8, const char* cProp, cmsFlo
cmsIT8* it8 = (cmsIT8*) hIT8;
char Buffer[1024];
- sprintf(Buffer, it8->DoubleFormatter, Val);
+ snprintf(Buffer, 1023, it8->DoubleFormatter, Val);
return AddToList(it8, &GetTable(it8)->HeaderList, cProp, NULL, Buffer, WRITE_UNCOOKED) != NULL;
}
@@ -1373,7 +1373,7 @@ cmsBool CMSEXPORT cmsIT8SetPropertyHex(cmsHANDLE hIT8, const char* cProp, cmsUIn
cmsIT8* it8 = (cmsIT8*) hIT8;
char Buffer[1024];
- sprintf(Buffer, "%u", Val);
+ snprintf(Buffer, 1023, "%u", Val);
return AddToList(it8, &GetTable(it8)->HeaderList, cProp, NULL, Buffer, WRITE_HEXADECIMAL) != NULL;
}
@@ -2516,8 +2516,10 @@ int LocateSample(cmsIT8* it8, const char* cSample)
for (i=0; i < t->nSamples; i++) {
fld = GetDataFormat(it8, i);
- if (cmsstrcasecmp(fld, cSample) == 0)
- return i;
+ if (fld != NULL) {
+ if (cmsstrcasecmp(fld, cSample) == 0)
+ return i;
+ }
}
return -1;
@@ -2575,7 +2577,7 @@ cmsBool CMSEXPORT cmsIT8SetDataRowColDbl(cmsHANDLE hIT8, int row, int col, cmsFl
_cmsAssert(hIT8 != NULL);
- sprintf(Buff, it8->DoubleFormatter, Val);
+ snprintf(Buff, 255, it8->DoubleFormatter, Val);
return SetData(it8, row, col, Buff);
}