Skip to content

Commit

Permalink
IlmImf: Fix misc compiler warnings.
Browse files Browse the repository at this point in the history
This allows IlmImf to compile cleanly with clang flags
-Wall -Wextra -Werror -Wno-unused-parameter

Fixes:
ImfOpaqueAttribute.h: 'const' type qualifier on return type has no effect [-Werror,-Wignored-qualifiers]
const int                   dataSize() const { return _dataSize; }
ImfDwaCompressor.cpp: error: comparison of integers of different signs: 'long' and 'size_t' (aka 'unsigned long') [-Werror,-Wsign-compare]
 if (cd->planarUncBufferEnd + dstScanlineSize - _planarUncBuffer[UNKNOWN] > _planarUncBufferSize[UNKNOWN] )
ImfMisc.cpp: warning: unused variable 'maxBytesPerLine' [-Wunused-variable]
    size_t maxBytesPerLine = bytesPerLineTable (header,
ImfDeepTiledInputFile.cpp:: error: comparison of integers of different signs: 'Imath_2_5::Int64' (aka 'unsigned long') and 'int' [-Werror,-Wsign-compare]
        if(_tileBuffer->dataSize != sizeOfTile)

Signed-off-by: Arkell Rasiah <arasiah@pixsystem.com>
  • Loading branch information
arkellr authored and cary-ilm committed Aug 9, 2020
1 parent 8e53ab8 commit 9534e36
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion OpenEXR/IlmImf/ImfDeepTiledInputFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@ TileBufferTask::execute ()
// sanity check data size: the uncompressed data should be exactly
// 'sizeOfTile' (if it's less, the file is corrupt and there'll be a buffer overrun)
//
if(_tileBuffer->dataSize != sizeOfTile)
if(_tileBuffer->dataSize != Int64(sizeOfTile))
{
THROW (IEX_NAMESPACE::InputExc, "size mismatch when reading deep tile: expected " << sizeOfTile << "bytes of uncompressed data but got " << _tileBuffer->dataSize);
}
Expand Down
2 changes: 1 addition & 1 deletion OpenEXR/IlmImf/ImfDwaCompressor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2820,7 +2820,7 @@ DwaCompressor::uncompress
//
// sanity check for buffer data lying within range
//
if (cd->planarUncBufferEnd + dstScanlineSize - _planarUncBuffer[UNKNOWN] > _planarUncBufferSize[UNKNOWN] )
if (cd->planarUncBufferEnd + (size_t) dstScanlineSize > _planarUncBuffer[UNKNOWN] + _planarUncBufferSize[UNKNOWN] )
{
throw Iex::InputExc("DWA data corrupt");
}
Expand Down
3 changes: 1 addition & 2 deletions OpenEXR/IlmImf/ImfMisc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1882,8 +1882,7 @@ getScanlineChunkOffsetTableSize(const Header& header)
const Box2i &dataWindow = header.dataWindow();

vector<size_t> bytesPerLine;
size_t maxBytesPerLine = bytesPerLineTable (header,
bytesPerLine);
(void) bytesPerLineTable (header, bytesPerLine);

int linesInBuffer = numLinesInBuffer ( header.compression() );

Expand Down
2 changes: 1 addition & 1 deletion OpenEXR/IlmImf/ImfOpaqueAttribute.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class OpaqueAttribute: public Attribute
virtual void copyValueFrom (const Attribute &other);


const int dataSize() const { return _dataSize; }
int dataSize() const { return _dataSize; }
const Array<char>& data() const { return _data; }

private:
Expand Down

0 comments on commit 9534e36

Please sign in to comment.