summaryrefslogtreecommitdiff
path: root/src/cmscgats.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmscgats.c')
-rw-r--r--src/cmscgats.c32
1 files changed, 15 insertions, 17 deletions
diff --git a/src/cmscgats.c b/src/cmscgats.c
index e4ccfbf..378392c 100644
--- a/src/cmscgats.c
+++ b/src/cmscgats.c
@@ -405,6 +405,18 @@ cmsBool isabsolutepath(const char *path)
return FALSE;
}
+// Parses float number
+static
+cmsFloat64Number ParseFloatNumber(const char *Buffer)
+{
+ if (Buffer) {
+ return atof(Buffer);
+ } else {
+ return 0.0;
+ }
+}
+
+
// Makes a file path based on a given reference path
// NOTE: this function doesn't check if the path exists or even if it's legal
static
@@ -1320,8 +1332,7 @@ cmsFloat64Number CMSEXPORT cmsIT8GetPropertyDbl(cmsHANDLE hIT8, const char* cPro
{
const char *v = cmsIT8GetProperty(hIT8, cProp);
- if (v) return atof(v);
- else return 0.0;
+ return ParseFloatNumber(v);
}
const char* CMSEXPORT cmsIT8GetPropertyMulti(cmsHANDLE hIT8, const char* Key, const char *SubKey)
@@ -2461,13 +2472,7 @@ cmsFloat64Number CMSEXPORT cmsIT8GetDataRowColDbl(cmsHANDLE hIT8, int row, int c
Buffer = cmsIT8GetDataRowCol(hIT8, row, col);
- if (Buffer) {
-
- return atof(Buffer);
-
- } else
- return 0;
-
+ return ParseFloatNumber(Buffer);
}
@@ -2522,14 +2527,7 @@ cmsFloat64Number CMSEXPORT cmsIT8GetDataDbl(cmsHANDLE it8, const char* cPatch,
Buffer = cmsIT8GetData(it8, cPatch, cSample);
- if (Buffer) {
-
- return atof(Buffer);
-
- } else {
-
- return 0;
- }
+ return ParseFloatNumber(Buffer);
}