Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compiler warnings from gcc-12 #1316

Merged
merged 3 commits into from
Nov 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/lib/OpenEXR/ImfCompositeDeepScanLine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ CompositeDeepScanLine::readPixels (int start, int end)
vector<unsigned int> num_sources (
total_pixels); //number of parts with non-zero sample count

size_t overall_sample_count =
int64_t overall_sample_count =
0; // sum of all samples in all images between start and end

//
Expand Down Expand Up @@ -561,7 +561,7 @@ CompositeDeepScanLine::readPixels (int start, int end)
// allocate pointers for channel data
//

size_t offset = 0;
int64_t offset = 0;

for (size_t pixel = 0; pixel < total_pixels; pixel++)
{
Expand Down
4 changes: 2 additions & 2 deletions src/lib/OpenEXR/ImfMultiPartInputFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ MultiPartInputFile::getPart (int partNumber)
const Header&
MultiPartInputFile::header (int n) const
{
if (n < 0 || n >= _data->_headers.size ())
if (n < 0 || static_cast<size_t>(n) >= _data->_headers.size ())
{
THROW (
IEX_NAMESPACE::ArgExc,
Expand Down Expand Up @@ -857,7 +857,7 @@ bool
MultiPartInputFile::partComplete (int part) const
{

if (part < 0 || part >= _data->_headers.size ())
if (part < 0 || static_cast<size_t>(part) >= _data->_headers.size ())
{
THROW (
IEX_NAMESPACE::ArgExc,
Expand Down
3 changes: 1 addition & 2 deletions src/lib/OpenEXRCore/internal_huf.c
Original file line number Diff line number Diff line change
Expand Up @@ -1300,7 +1300,7 @@ fasthuf_initialize (
for (int i = 0; i < MAX_CODE_LEN; ++i)
fhd->_numSymbols += codeCount[i];

if (fhd->_numSymbols > sizeof (fhd->_idToSymbol) / sizeof (int))
if ((size_t) fhd->_numSymbols > sizeof (fhd->_idToSymbol) / sizeof (int))
{
if (pctxt)
pctxt->print_error (
Expand Down Expand Up @@ -1809,7 +1809,6 @@ internal_huf_decompress (
uint64_t* freq = (uint64_t*) spare;
HufDec* hdec = (HufDec*) (freq + HUF_ENCSIZE);
uint64_t nLeft = nCompressed - 20;
uint64_t nTableSz = 0;

hufClearDecTable (hdec);
hufUnpackEncTable (&ptr, &nLeft, im, iM, freq);
Expand Down
8 changes: 4 additions & 4 deletions src/lib/OpenEXRCore/internal_zip.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,10 @@ interleave (uint8_t* out, const uint8_t* source, uint64_t outSize)
static void
interleave (uint8_t* out, const uint8_t* source, uint64_t outSize)
{
const char* t1 = source;
const char* t2 = source + (outSize + 1) / 2;
char* s = out;
char* const stop = s + outSize;
const uint8_t* t1 = source;
const uint8_t* t2 = source + (outSize + 1) / 2;
uint8_t* s = out;
uint8_t* const stop = s + outSize;

while (true)
{
Expand Down
8 changes: 2 additions & 6 deletions src/lib/OpenEXRUtil/ImfCheckFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ readDeepScanLine (T& in, bool reduceMemory, bool reduceTime)
//
size_t bufferSize = 0;
size_t fileBufferSize = 0;
for (int j = 0; j < w; j++)
for (uint64_t j = 0; j < w; j++)
{
for (int k = 0; k < channelCount; k++)
{
Expand Down Expand Up @@ -507,7 +507,7 @@ readDeepScanLine (T& in, bool reduceMemory, bool reduceTime)
pixelBuffer.resize (bufferSize);

size_t bufferIndex = 0;
for (int j = 0; j < w; j++)
for (uint64_t j = 0; j < w; j++)
{
for (int k = 0; k < channelCount; k++)
{
Expand Down Expand Up @@ -563,8 +563,6 @@ readDeepTile (T& in, bool reduceMemory, bool reduceTime)

Array2D<unsigned int> localSampleCount;

Box2i dataWindow = fileHeader.dataWindow ();

int bytesPerSample = calculateBytesPerPixel (in.header ());

const TileDescription& td = in.header ().tileDescription ();
Expand Down Expand Up @@ -1074,7 +1072,6 @@ runChecks (T& source, bool reduceMemory, bool reduceTime)
try
{
MultiPartInputFile multi (source);
Box2i b = multi.header (0).dataWindow ();

//
// significant memory is also required to read a tiled file
Expand Down Expand Up @@ -1221,7 +1218,6 @@ readCoreScanlinePart (

std::vector<uint8_t> imgdata;
bool doread = false;
exr_chunk_info_t cinfo;
exr_decode_pipeline_t decoder = EXR_DECODE_PIPELINE_INITIALIZER;

int32_t lines_per_chunk;
Expand Down
2 changes: 1 addition & 1 deletion src/test/OpenEXRTest/testAttributes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ static int move_assignment_operator;

struct TestType
{
TestType () { default_constructor++; }
TestType () : _f(0) { default_constructor++; }

~TestType () { destructor++; }

Expand Down
2 changes: 1 addition & 1 deletion src/test/OpenEXRTest/testPreviewImage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ readWriteFiles (
file2.setFrameBuffer (pixels2 - dx - dy * w, 1, w);
file2.readPixels (dw.min.y, dw.max.y);

for (size_t i = 0; i < w * h; ++i)
for (int i = 0; i < w * h; ++i)
{
assert (pixels1[i].r == pixels2[i].r);
assert (pixels1[i].g == pixels2[i].g);
Expand Down