summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormm2 <marti.maria@littlecms.com>2021-02-22 17:49:50 +0100
committermm2 <marti.maria@littlecms.com>2021-02-22 17:49:50 +0100
commitab541149609b20da770f427e9ca72b40230665a4 (patch)
treecef7267b4b8b9abee13fb85dc2380650277c0a5a /src
parent924a020d09bfe468c665467caf24aadeb41ff77c (diff)
downloadlcms2-ab541149609b20da770f427e9ca72b40230665a4.tar.gz
Fixes from Artifex
Thanks to Robin Watts for pointing out
Diffstat (limited to 'src')
-rw-r--r--src/cmscgats.c21
-rw-r--r--src/cmstypes.c4
2 files changed, 21 insertions, 4 deletions
diff --git a/src/cmscgats.c b/src/cmscgats.c
index b813e9a..5a1d4b7 100644
--- a/src/cmscgats.c
+++ b/src/cmscgats.c
@@ -1504,6 +1504,25 @@ cmsInt32Number satoi(const char* b)
return atoi(b);
}
+// Convert to binary
+static
+const char* satob(const char* v)
+{
+ cmsUInt32Number x;
+ static char buf[33];
+ char *s = buf + 33;
+
+ if (v == NULL) return "0";
+
+ x = atoi(v);
+ *--s = 0;
+ if (!x) *--s = '0';
+ for (; x; x /= 2) *--s = '0' + x%2;
+
+ return s;
+}
+
+
static
void AllocateDataSet(cmsIT8* it8)
{
@@ -1689,7 +1708,7 @@ void WriteHeader(cmsIT8* it8, SAVESTREAM* fp)
break;
case WRITE_BINARY:
- Writef(fp, "\t0x%B", satoi(p ->Value));
+ Writef(fp, "\t0b%s", satob(p ->Value));
break;
case WRITE_PAIR:
diff --git a/src/cmstypes.c b/src/cmstypes.c
index 825b11e..6512683 100644
--- a/src/cmstypes.c
+++ b/src/cmstypes.c
@@ -1853,7 +1853,7 @@ Error:
static
cmsBool Type_LUT8_Write(struct _cms_typehandler_struct* self, cmsIOHANDLER* io, void* Ptr, cmsUInt32Number nItems)
{
- cmsUInt32Number j, nTabSize, i, n;
+ cmsUInt32Number j, nTabSize, i;
cmsUInt8Number val;
cmsPipeline* NewLUT = (cmsPipeline*) Ptr;
cmsStage* mpe;
@@ -1902,8 +1902,6 @@ cmsBool Type_LUT8_Write(struct _cms_typehandler_struct* self, cmsIOHANDLER* io,
if (!_cmsWriteUInt8Number(io, (cmsUInt8Number) clutPoints)) return FALSE;
if (!_cmsWriteUInt8Number(io, 0)) return FALSE; // Padding
- n = NewLUT->InputChannels * NewLUT->OutputChannels;
-
if (MatMPE != NULL) {
for (i = 0; i < 9; i++)