summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarti <marti.maria@tktbrainpower.com>2016-12-15 17:37:49 +0100
committerMarti <marti.maria@tktbrainpower.com>2016-12-15 17:37:49 +0100
commitcaac341456636287e909cd6c4727c4ed76022c1e (patch)
tree94744678076b122f1d8159998d87314c41c9d4c8 /src
parent4011a6e3427c8c287226c5079ceee4c76d617dce (diff)
downloadlcms2-caac341456636287e909cd6c4727c4ed76022c1e.tar.gz
Cleanup on some warnings
Thanks to JDK team for pointing that
Diffstat (limited to 'src')
-rw-r--r--src/cmserr.c4
-rw-r--r--src/cmsio0.c16
-rw-r--r--src/cmslut.c3
-rw-r--r--src/cmstypes.c2
-rw-r--r--src/cmsxform.c8
5 files changed, 26 insertions, 7 deletions
diff --git a/src/cmserr.c b/src/cmserr.c
index 700152e..73e656c 100644
--- a/src/cmserr.c
+++ b/src/cmserr.c
@@ -54,9 +54,11 @@ long int CMSEXPORT cmsfilelength(FILE* f)
long int p , n;
p = ftell(f); // register current file position
+ if (p == -1L)
+ return -1L;
if (fseek(f, 0, SEEK_END) != 0) {
- return -1;
+ return -1L;
}
n = ftell(f);
diff --git a/src/cmsio0.c b/src/cmsio0.c
index 927c483..41752f3 100644
--- a/src/cmsio0.c
+++ b/src/cmsio0.c
@@ -337,21 +337,27 @@ cmsBool FileSeek(cmsIOHANDLER* iohandler, cmsUInt32Number offset)
return TRUE;
}
-// Returns file pointer position
+// Returns file pointer position or 0 on error, which is also a valid position.
static
cmsUInt32Number FileTell(cmsIOHANDLER* iohandler)
{
- return (cmsUInt32Number) ftell((FILE*)iohandler ->stream);
+ long t = ftell((FILE*)iohandler ->stream);
+ if (t == -1L) {
+ cmsSignalError(iohandler->ContextID, cmsERROR_FILE, "Tell error; probably corrupted file");
+ return 0;
+ }
+
+ return (cmsUInt32Number)t;
}
// Writes data to stream, also keeps used space for further reference. Returns TRUE on success, FALSE on error
static
cmsBool FileWrite(cmsIOHANDLER* iohandler, cmsUInt32Number size, const void* Buffer)
{
- if (size == 0) return TRUE; // We allow to write 0 bytes, but nothing is written
+ if (size == 0) return TRUE; // We allow to write 0 bytes, but nothing is written
- iohandler->UsedSpace += size;
- return (fwrite(Buffer, size, 1, (FILE*) iohandler->stream) == 1);
+ iohandler->UsedSpace += size;
+ return (fwrite(Buffer, size, 1, (FILE*)iohandler->stream) == 1);
}
// Closes the file
diff --git a/src/cmslut.c b/src/cmslut.c
index 0a13018..8556bcb 100644
--- a/src/cmslut.c
+++ b/src/cmslut.c
@@ -770,6 +770,9 @@ cmsBool CMSEXPORT cmsStageSampleCLut16bit(cmsStage* mpe, cmsSAMPLER16 Sampler, v
if (nInputs > MAX_INPUT_DIMENSIONS) return FALSE;
if (nOutputs >= MAX_STAGE_CHANNELS) return FALSE;
+ memset(In, 0, sizeof(In));
+ memset(Out, 0, sizeof(Out));
+
nTotalPoints = CubeSize(nSamples, nInputs);
if (nTotalPoints == 0) return FALSE;
diff --git a/src/cmstypes.c b/src/cmstypes.c
index ef54f34..dd1517f 100644
--- a/src/cmstypes.c
+++ b/src/cmstypes.c
@@ -237,7 +237,7 @@ cmsBool WritePositionTable(struct _cms_typehandler_struct* self,
// Keep starting position of curve offsets
DirectoryPos = io ->Tell(io);
-
+
// Write a fake directory to be filled latter on
for (i=0; i < Count; i++) {
diff --git a/src/cmsxform.c b/src/cmsxform.c
index 254d003..ff56d95 100644
--- a/src/cmsxform.c
+++ b/src/cmsxform.c
@@ -255,6 +255,8 @@ void FloatXFORM(_cmsTRANSFORM* p,
strideIn = 0;
strideOut = 0;
+ memset(fIn, 0, sizeof(fIn));
+ memset(fOut, 0, sizeof(fIn));
for (i = 0; i < LineCount; i++) {
@@ -319,6 +321,7 @@ void NullFloatXFORM(_cmsTRANSFORM* p,
strideIn = 0;
strideOut = 0;
+ memset(fIn, 0, sizeof(fIn));
for (i = 0; i < LineCount; i++) {
@@ -356,6 +359,7 @@ void NullXFORM(_cmsTRANSFORM* p,
strideIn = 0;
strideOut = 0;
+ memset(wIn, 0, sizeof(wIn));
for (i = 0; i < LineCount; i++) {
@@ -393,6 +397,8 @@ void PrecalculatedXFORM(_cmsTRANSFORM* p,
strideIn = 0;
strideOut = 0;
+ memset(wIn, 0, sizeof(wIn));
+ memset(wOut, 0, sizeof(wOut));
for (i = 0; i < LineCount; i++) {
@@ -454,6 +460,8 @@ void PrecalculatedXFORMGamutCheck(_cmsTRANSFORM* p,
strideIn = 0;
strideOut = 0;
+ memset(wIn, 0, sizeof(wIn));
+ memset(wOut, 0, sizeof(wOut));
for (i = 0; i < LineCount; i++) {