diff --git a/IlmBase/Half/half.h b/IlmBase/Half/half.h index 6a53b2fb89..6a5ee23d89 100644 --- a/IlmBase/Half/half.h +++ b/IlmBase/Half/half.h @@ -96,9 +96,12 @@ class half // Constructors //------------- - half (); // no initialization + half () = default; // no initialization half (float f); - + // rule of 5 + ~half () = default; + half (const half &) = default; + half (half &&) noexcept = default; //-------------------- // Conversion to float @@ -118,7 +121,8 @@ class half // Assignment //----------- - half & operator = (half h); + half & operator = (const half &h) = default; + half & operator = (half &&h) noexcept = default; half & operator = (float f); half & operator += (half h); @@ -417,17 +421,6 @@ HALF_EXPORT void printBits (char c[35], float f); //--------------------------------------------------------------------------- -//-------------------- -// Simple constructors -//-------------------- - -inline -half::half () -{ - // no initialization -} - - //---------------------------- // Half-from-float constructor //---------------------------- @@ -575,14 +568,6 @@ half::operator - () const } -inline half & -half::operator = (half h) -{ - _h = h._h; - return *this; -} - - inline half & half::operator = (float f) { diff --git a/IlmBase/Half/halfFunction.h b/IlmBase/Half/halfFunction.h index 98c1d17bd3..36462ba938 100644 --- a/IlmBase/Half/halfFunction.h +++ b/IlmBase/Half/halfFunction.h @@ -148,7 +148,6 @@ halfFunction::halfFunction (Function f, { #ifndef ILMBASE_HAVE_LARGE_STACK _lut = new T[1<<16]; - memset (_lut, 0 , (1<<16) * sizeof(T)); #endif for (int i = 0; i < (1 << 16); i++) diff --git a/IlmBase/HalfTest/main.cpp b/IlmBase/HalfTest/main.cpp index 637ecabe38..add599057c 100644 --- a/IlmBase/HalfTest/main.cpp +++ b/IlmBase/HalfTest/main.cpp @@ -3,6 +3,10 @@ // Copyright Contributors to the OpenEXR Project. // +#ifdef NDEBUG +# undef NDEBUG +#endif + #include #include #include diff --git a/IlmBase/HalfTest/testArithmetic.cpp b/IlmBase/HalfTest/testArithmetic.cpp index 5b06c481ac..e02849543f 100644 --- a/IlmBase/HalfTest/testArithmetic.cpp +++ b/IlmBase/HalfTest/testArithmetic.cpp @@ -3,6 +3,10 @@ // Copyright Contributors to the OpenEXR Project. // +#ifdef NDEBUG +# undef NDEBUG +#endif + #include #include "half.h" #include diff --git a/IlmBase/HalfTest/testBitPatterns.cpp b/IlmBase/HalfTest/testBitPatterns.cpp index ecf56e8ad3..6f3e970806 100644 --- a/IlmBase/HalfTest/testBitPatterns.cpp +++ b/IlmBase/HalfTest/testBitPatterns.cpp @@ -3,6 +3,10 @@ // Copyright Contributors to the OpenEXR Project. // +#ifdef NDEBUG +# undef NDEBUG +#endif + #include #include "half.h" #include diff --git a/IlmBase/HalfTest/testClassification.cpp b/IlmBase/HalfTest/testClassification.cpp index 13c9edc237..4bf9dec532 100644 --- a/IlmBase/HalfTest/testClassification.cpp +++ b/IlmBase/HalfTest/testClassification.cpp @@ -3,6 +3,10 @@ // Copyright Contributors to the OpenEXR Project. // +#ifdef NDEBUG +# undef NDEBUG +#endif + #include #include "half.h" #include diff --git a/IlmBase/HalfTest/testError.cpp b/IlmBase/HalfTest/testError.cpp index ac53381106..ac813a880b 100644 --- a/IlmBase/HalfTest/testError.cpp +++ b/IlmBase/HalfTest/testError.cpp @@ -3,6 +3,10 @@ // Copyright Contributors to the OpenEXR Project. // +#ifdef NDEBUG +# undef NDEBUG +#endif + #include #include "half.h" #include diff --git a/IlmBase/HalfTest/testFunction.cpp b/IlmBase/HalfTest/testFunction.cpp index 78d8d454ea..8c7c69b5f3 100644 --- a/IlmBase/HalfTest/testFunction.cpp +++ b/IlmBase/HalfTest/testFunction.cpp @@ -3,6 +3,10 @@ // Copyright Contributors to the OpenEXR Project. // +#ifdef NDEBUG +# undef NDEBUG +#endif + #include #include "halfFunction.h" #include diff --git a/IlmBase/HalfTest/testLimits.cpp b/IlmBase/HalfTest/testLimits.cpp index 54b2bbc129..1a09f76c0d 100644 --- a/IlmBase/HalfTest/testLimits.cpp +++ b/IlmBase/HalfTest/testLimits.cpp @@ -3,6 +3,10 @@ // Copyright Contributors to the OpenEXR Project. // +#ifdef NDEBUG +# undef NDEBUG +#endif + #include #include "halfLimits.h" #include diff --git a/IlmBase/HalfTest/testSize.cpp b/IlmBase/HalfTest/testSize.cpp index 370081981d..8a20106802 100644 --- a/IlmBase/HalfTest/testSize.cpp +++ b/IlmBase/HalfTest/testSize.cpp @@ -3,6 +3,10 @@ // Copyright Contributors to the OpenEXR Project. // +#ifdef NDEBUG +# undef NDEBUG +#endif + #include #include "half.h" #include diff --git a/IlmBase/IexTest/main.cpp b/IlmBase/IexTest/main.cpp index 8b8d7f4855..a9bb680936 100644 --- a/IlmBase/IexTest/main.cpp +++ b/IlmBase/IexTest/main.cpp @@ -32,7 +32,9 @@ // /////////////////////////////////////////////////////////////////////////// - +#ifdef NDEBUG +# undef NDEBUG +#endif #include diff --git a/IlmBase/IexTest/testBaseExc.cpp b/IlmBase/IexTest/testBaseExc.cpp index 7bb642e1a8..a8c54a1bd9 100644 --- a/IlmBase/IexTest/testBaseExc.cpp +++ b/IlmBase/IexTest/testBaseExc.cpp @@ -32,7 +32,9 @@ // /////////////////////////////////////////////////////////////////////////// - +#ifdef NDEBUG +# undef NDEBUG +#endif #include #include diff --git a/IlmBase/IlmThread/IlmThreadSemaphorePosix.cpp b/IlmBase/IlmThread/IlmThreadSemaphorePosix.cpp index 400d90effc..a94bdb842c 100644 --- a/IlmBase/IlmThread/IlmThreadSemaphorePosix.cpp +++ b/IlmBase/IlmThread/IlmThreadSemaphorePosix.cpp @@ -60,8 +60,12 @@ Semaphore::Semaphore (unsigned int value) Semaphore::~Semaphore () { +#ifdef NDEBUG + ::sem_destroy (&_semaphore); +#else int error = ::sem_destroy (&_semaphore); assert (error == 0); +#endif } diff --git a/IlmBase/Imath/ImathFrustum.h b/IlmBase/Imath/ImathFrustum.h index 4df92c90f4..d9ad35452d 100644 --- a/IlmBase/Imath/ImathFrustum.h +++ b/IlmBase/Imath/ImathFrustum.h @@ -278,7 +278,8 @@ void Frustum::modifyNearAndFar(T n, T f) Line3 upperRight( Vec3(0,0,0), Vec3(_right,_top,-_nearPlane) ); Plane3 nearPlane( Vec3(0,0,-1), n ); - Vec3 ll,ur; + Vec3 ll = Vec3 (0, 0, 0); + Vec3 ur = Vec3 (0, 0, 0); nearPlane.intersect(lowerLeft,ll); nearPlane.intersect(upperRight,ur); diff --git a/IlmBase/ImathTest/main.cpp b/IlmBase/ImathTest/main.cpp index f5c7dd3fe8..a0c117f6d9 100644 --- a/IlmBase/ImathTest/main.cpp +++ b/IlmBase/ImathTest/main.cpp @@ -32,7 +32,9 @@ // /////////////////////////////////////////////////////////////////////////// - +#ifdef NDEBUG +# undef NDEBUG +#endif #include #include diff --git a/IlmBase/ImathTest/testBox.cpp b/IlmBase/ImathTest/testBox.cpp index 0727a4b63d..a8f6537cab 100644 --- a/IlmBase/ImathTest/testBox.cpp +++ b/IlmBase/ImathTest/testBox.cpp @@ -32,6 +32,9 @@ // /////////////////////////////////////////////////////////////////////////// +#ifdef NDEBUG +# undef NDEBUG +#endif #include #include "ImathBoxAlgo.h" diff --git a/IlmBase/ImathTest/testBoxAlgo.cpp b/IlmBase/ImathTest/testBoxAlgo.cpp index 9eceba3574..aff666e4e8 100644 --- a/IlmBase/ImathTest/testBoxAlgo.cpp +++ b/IlmBase/ImathTest/testBoxAlgo.cpp @@ -32,6 +32,9 @@ // /////////////////////////////////////////////////////////////////////////// +#ifdef NDEBUG +# undef NDEBUG +#endif #include #include "ImathBoxAlgo.h" diff --git a/IlmBase/ImathTest/testColor.cpp b/IlmBase/ImathTest/testColor.cpp index 55f2903273..5b40b588ea 100644 --- a/IlmBase/ImathTest/testColor.cpp +++ b/IlmBase/ImathTest/testColor.cpp @@ -32,7 +32,9 @@ // /////////////////////////////////////////////////////////////////////////// - +#ifdef NDEBUG +# undef NDEBUG +#endif #include #include "ImathColor.h" diff --git a/IlmBase/ImathTest/testExtractEuler.cpp b/IlmBase/ImathTest/testExtractEuler.cpp index 311c01e3ae..c91b5a3eca 100644 --- a/IlmBase/ImathTest/testExtractEuler.cpp +++ b/IlmBase/ImathTest/testExtractEuler.cpp @@ -32,6 +32,9 @@ // /////////////////////////////////////////////////////////////////////////// +#ifdef NDEBUG +# undef NDEBUG +#endif #include #include "ImathMatrixAlgo.h" diff --git a/IlmBase/ImathTest/testExtractSHRT.cpp b/IlmBase/ImathTest/testExtractSHRT.cpp index 6661f6f025..f6d4905a06 100644 --- a/IlmBase/ImathTest/testExtractSHRT.cpp +++ b/IlmBase/ImathTest/testExtractSHRT.cpp @@ -32,6 +32,9 @@ // /////////////////////////////////////////////////////////////////////////// +#ifdef NDEBUG +# undef NDEBUG +#endif #include #include "ImathMatrixAlgo.h" @@ -67,10 +70,14 @@ testMatrix (const M33f M) // angle back to a matrix, N. // - V2f s, t; - float h, r; + V2f s(0.f), t(0.f); + float h, r= 0.f; - extractSHRT (M, s, h, r, t, true); + if (!extractSHRT (M, s, h, r, t, true)) + { + cout << "Unable to extractSHRT" << std::endl; + assert(false); + } M33f N; @@ -443,4 +450,3 @@ testExtractSHRT () cerr << " Caught exception: " << e.what () << endl; } } - diff --git a/IlmBase/ImathTest/testFrustum.cpp b/IlmBase/ImathTest/testFrustum.cpp index 31ba99cc55..e917666e70 100644 --- a/IlmBase/ImathTest/testFrustum.cpp +++ b/IlmBase/ImathTest/testFrustum.cpp @@ -32,7 +32,9 @@ // /////////////////////////////////////////////////////////////////////////// - +#ifdef NDEBUG +# undef NDEBUG +#endif #include #include "ImathFrustum.h" @@ -225,7 +227,7 @@ testFrustum () (void)badFrustum.projectionMatrix(); assert (!"near == far didn't throw an exception"); } - catch (IEX_NAMESPACE::DivzeroExc) + catch (IEX_NAMESPACE::DivzeroExc &) { caught = true; } @@ -239,7 +241,7 @@ testFrustum () (void)badFrustum.projectionMatrix(); assert (!"left == right didn't throw an exception"); } - catch (IEX_NAMESPACE::DivzeroExc) + catch (IEX_NAMESPACE::DivzeroExc &) { caught = true; } @@ -253,7 +255,7 @@ testFrustum () (void)badFrustum.projectionMatrix(); assert (!"top == bottom didn't throw an exception"); } - catch (IEX_NAMESPACE::DivzeroExc) + catch (IEX_NAMESPACE::DivzeroExc &) { caught = true; } diff --git a/IlmBase/ImathTest/testFrustumTest.cpp b/IlmBase/ImathTest/testFrustumTest.cpp index d455f0ccea..37e96d4b55 100644 --- a/IlmBase/ImathTest/testFrustumTest.cpp +++ b/IlmBase/ImathTest/testFrustumTest.cpp @@ -32,7 +32,9 @@ // /////////////////////////////////////////////////////////////////////////// - +#ifdef NDEBUG +# undef NDEBUG +#endif #include #include "ImathFrustum.h" diff --git a/IlmBase/ImathTest/testFun.cpp b/IlmBase/ImathTest/testFun.cpp index c945e48e48..b0840894a8 100644 --- a/IlmBase/ImathTest/testFun.cpp +++ b/IlmBase/ImathTest/testFun.cpp @@ -32,6 +32,9 @@ // /////////////////////////////////////////////////////////////////////////// +#ifdef NDEBUG +# undef NDEBUG +#endif #include #include "ImathFun.h" diff --git a/IlmBase/ImathTest/testInvert.cpp b/IlmBase/ImathTest/testInvert.cpp index fb52d703fc..ea8d663126 100644 --- a/IlmBase/ImathTest/testInvert.cpp +++ b/IlmBase/ImathTest/testInvert.cpp @@ -32,7 +32,9 @@ // /////////////////////////////////////////////////////////////////////////// - +#ifdef NDEBUG +# undef NDEBUG +#endif #include #include "ImathMatrix.h" diff --git a/IlmBase/ImathTest/testJacobiEigenSolver.cpp b/IlmBase/ImathTest/testJacobiEigenSolver.cpp index e2e5f14054..09e5a70812 100644 --- a/IlmBase/ImathTest/testJacobiEigenSolver.cpp +++ b/IlmBase/ImathTest/testJacobiEigenSolver.cpp @@ -32,6 +32,10 @@ // /////////////////////////////////////////////////////////////////////////// +#ifdef NDEBUG +# undef NDEBUG +#endif + #include "ImathMatrix.h" #include "ImathMatrixAlgo.h" #include @@ -309,5 +313,3 @@ testJacobiEigenSolver() cout << "************ ALL PASS ************" << endl; } - - diff --git a/IlmBase/ImathTest/testLineAlgo.cpp b/IlmBase/ImathTest/testLineAlgo.cpp index 21a642c033..deee762e93 100644 --- a/IlmBase/ImathTest/testLineAlgo.cpp +++ b/IlmBase/ImathTest/testLineAlgo.cpp @@ -32,6 +32,9 @@ // /////////////////////////////////////////////////////////////////////////// +#ifdef NDEBUG +# undef NDEBUG +#endif #include #include "ImathLineAlgo.h" diff --git a/IlmBase/ImathTest/testMatrix.cpp b/IlmBase/ImathTest/testMatrix.cpp index 650051e571..1005820b5d 100644 --- a/IlmBase/ImathTest/testMatrix.cpp +++ b/IlmBase/ImathTest/testMatrix.cpp @@ -32,7 +32,9 @@ // /////////////////////////////////////////////////////////////////////////// - +#ifdef NDEBUG +# undef NDEBUG +#endif #include #include "ImathMatrix.h" diff --git a/IlmBase/ImathTest/testMiscMatrixAlgo.cpp b/IlmBase/ImathTest/testMiscMatrixAlgo.cpp index 5b411148f4..04d6cdcf56 100644 --- a/IlmBase/ImathTest/testMiscMatrixAlgo.cpp +++ b/IlmBase/ImathTest/testMiscMatrixAlgo.cpp @@ -32,6 +32,9 @@ // /////////////////////////////////////////////////////////////////////////// +#ifdef NDEBUG +# undef NDEBUG +#endif #include #include "ImathMatrixAlgo.h" @@ -337,5 +340,3 @@ testMiscMatrixAlgo () cerr << " Caught exception: " << e.what () << endl; } } - - diff --git a/IlmBase/ImathTest/testProcrustes.cpp b/IlmBase/ImathTest/testProcrustes.cpp index 7e86d41c28..3b4615268e 100644 --- a/IlmBase/ImathTest/testProcrustes.cpp +++ b/IlmBase/ImathTest/testProcrustes.cpp @@ -32,6 +32,10 @@ // /////////////////////////////////////////////////////////////////////////// +#ifdef NDEBUG +# undef NDEBUG +#endif + #include "ImathMatrixAlgo.h" #include "ImathRandom.h" #include "ImathEuler.h" @@ -398,5 +402,3 @@ testProcrustes () std::cout << "Testing Procrustes algorithms in double precision..." << std::endl; testProcrustesImp(); } - - diff --git a/IlmBase/ImathTest/testQuat.cpp b/IlmBase/ImathTest/testQuat.cpp index a4e915ccc3..dfb6aed6ba 100644 --- a/IlmBase/ImathTest/testQuat.cpp +++ b/IlmBase/ImathTest/testQuat.cpp @@ -32,6 +32,9 @@ // /////////////////////////////////////////////////////////////////////////// +#ifdef NDEBUG +# undef NDEBUG +#endif #include #include "ImathQuat.h" diff --git a/IlmBase/ImathTest/testQuatSetRotation.cpp b/IlmBase/ImathTest/testQuatSetRotation.cpp index 6f9ad302e8..170ac1d764 100644 --- a/IlmBase/ImathTest/testQuatSetRotation.cpp +++ b/IlmBase/ImathTest/testQuatSetRotation.cpp @@ -32,6 +32,9 @@ // /////////////////////////////////////////////////////////////////////////// +#ifdef NDEBUG +# undef NDEBUG +#endif #include #include "ImathQuat.h" diff --git a/IlmBase/ImathTest/testQuatSlerp.cpp b/IlmBase/ImathTest/testQuatSlerp.cpp index f3e37e54bf..10f5d70466 100644 --- a/IlmBase/ImathTest/testQuatSlerp.cpp +++ b/IlmBase/ImathTest/testQuatSlerp.cpp @@ -32,6 +32,9 @@ // /////////////////////////////////////////////////////////////////////////// +#ifdef NDEBUG +# undef NDEBUG +#endif #include #include "ImathQuat.h" @@ -197,4 +200,3 @@ testQuatSlerp () cout << "ok\n" << endl; } - diff --git a/IlmBase/ImathTest/testRandom.cpp b/IlmBase/ImathTest/testRandom.cpp index 7798c00cab..9f35381045 100644 --- a/IlmBase/ImathTest/testRandom.cpp +++ b/IlmBase/ImathTest/testRandom.cpp @@ -32,7 +32,9 @@ // /////////////////////////////////////////////////////////////////////////// - +#ifdef NDEBUG +# undef NDEBUG +#endif #include #include "ImathRandom.h" diff --git a/IlmBase/ImathTest/testRoots.cpp b/IlmBase/ImathTest/testRoots.cpp index e95df95336..d5a24ff074 100644 --- a/IlmBase/ImathTest/testRoots.cpp +++ b/IlmBase/ImathTest/testRoots.cpp @@ -32,7 +32,9 @@ // /////////////////////////////////////////////////////////////////////////// - +#ifdef NDEBUG +# undef NDEBUG +#endif #include #include "ImathRoots.h" @@ -161,7 +163,7 @@ solve (double a, double b, double c, // coefficients // Solve the equation a*x^2 + b*x^1 + c*x // - double x[2]; + double x[2] = {0.0, 0.0}; int n = IMATH_INTERNAL_NAMESPACE::solveQuadratic (a, b, c, x); // @@ -169,7 +171,7 @@ solve (double a, double b, double c, // coefficients // Sort the expected solutions. // // Dummy variable for sort - double x2; + double x2 = 0; sort (nx, x0, x1, x2); sort (n, x); @@ -256,5 +258,3 @@ testRoots () solve (3, -6, 30, 0, 0, 0); // real solutions: none cout << "ok\n" << endl; } - - diff --git a/IlmBase/ImathTest/testShear.cpp b/IlmBase/ImathTest/testShear.cpp index 7783f7d4e4..0e88b763b5 100644 --- a/IlmBase/ImathTest/testShear.cpp +++ b/IlmBase/ImathTest/testShear.cpp @@ -32,7 +32,9 @@ // /////////////////////////////////////////////////////////////////////////// - +#ifdef NDEBUG +# undef NDEBUG +#endif #include #include "ImathShear.h" diff --git a/IlmBase/ImathTest/testTinySVD.cpp b/IlmBase/ImathTest/testTinySVD.cpp index 02c883e1e8..8974dacf86 100644 --- a/IlmBase/ImathTest/testTinySVD.cpp +++ b/IlmBase/ImathTest/testTinySVD.cpp @@ -32,6 +32,10 @@ // /////////////////////////////////////////////////////////////////////////// +#ifdef NDEBUG +# undef NDEBUG +#endif + #include "ImathMatrixAlgo.h" #include #include @@ -357,4 +361,3 @@ testTinySVD () std::cout << "Testing TinySVD algorithms in double precision..." << std::endl; testTinySVDImp(); } - diff --git a/IlmBase/ImathTest/testVec.cpp b/IlmBase/ImathTest/testVec.cpp index 01698e3257..c3490e57a3 100644 --- a/IlmBase/ImathTest/testVec.cpp +++ b/IlmBase/ImathTest/testVec.cpp @@ -32,6 +32,9 @@ // /////////////////////////////////////////////////////////////////////////// +#ifdef NDEBUG +# undef NDEBUG +#endif #include #include "ImathVec.h" diff --git a/OpenEXR/IlmImf/ImfB44Compressor.cpp b/OpenEXR/IlmImf/ImfB44Compressor.cpp index f13e143f52..3b18ba8551 100644 --- a/OpenEXR/IlmImf/ImfB44Compressor.cpp +++ b/OpenEXR/IlmImf/ImfB44Compressor.cpp @@ -484,6 +484,8 @@ B44Compressor::B44Compressor _channels (hdr.channels()), _channelData (0) { + // TODO: Remove this when we can change the ABI + (void)_maxScanLineSize; // // Allocate buffers for compressed an uncompressed pixel data, // allocate a set of ChannelData structs to help speed up the diff --git a/OpenEXR/IlmImf/ImfDeepScanLineInputFile.cpp b/OpenEXR/IlmImf/ImfDeepScanLineInputFile.cpp index b4246762a0..6f329f0b39 100644 --- a/OpenEXR/IlmImf/ImfDeepScanLineInputFile.cpp +++ b/OpenEXR/IlmImf/ImfDeepScanLineInputFile.cpp @@ -1800,7 +1800,7 @@ readSampleCountForLineBlock(InputStreamMutex* streamData, - if(sampleCountTableDataSize>data->maxSampleCountTableSize) + if(sampleCountTableDataSize>static_cast(data->maxSampleCountTableSize)) { THROW (IEX_NAMESPACE::ArgExc, "Bad sampleCountTableDataSize read from chunk "<< lineBlockId << ": expected " << data->maxSampleCountTableSize << " or less, got "<< sampleCountTableDataSize); } @@ -1839,7 +1839,7 @@ readSampleCountForLineBlock(InputStreamMutex* streamData, // - if (sampleCountTableDataSize < data->maxSampleCountTableSize) + if (sampleCountTableDataSize < static_cast(data->maxSampleCountTableSize)) { if(!data->sampleCountTableComp) { diff --git a/OpenEXR/IlmImf/ImfDeepScanLineOutputFile.cpp b/OpenEXR/IlmImf/ImfDeepScanLineOutputFile.cpp index 5fe0be3fda..dbafc1fcf4 100644 --- a/OpenEXR/IlmImf/ImfDeepScanLineOutputFile.cpp +++ b/OpenEXR/IlmImf/ImfDeepScanLineOutputFile.cpp @@ -297,7 +297,7 @@ writeLineOffsets (OPENEXR_IMF_INTERNAL_NAMESPACE::OStream &os, const vector(-1)) IEX_NAMESPACE::throwErrnoExc ("Cannot determine current file position (%T)."); for (unsigned int i = 0; i < lineOffsets.size(); i++) diff --git a/OpenEXR/IlmImf/ImfDwaCompressor.cpp b/OpenEXR/IlmImf/ImfDwaCompressor.cpp index 0247c9f653..d029121d1b 100644 --- a/OpenEXR/IlmImf/ImfDwaCompressor.cpp +++ b/OpenEXR/IlmImf/ImfDwaCompressor.cpp @@ -272,7 +272,7 @@ struct DwaCompressor::Classifier _suffix = std::string(suffix); } - if (size < _suffix.length() + 1 + 2*Xdr::size()) + if (static_cast(size) < _suffix.length() + 1 + 2*Xdr::size()) throw IEX_NAMESPACE::InputExc("Error uncompressing DWA data" " (truncated rule)."); @@ -700,7 +700,7 @@ DwaCompressor::LossyDctDecoderBase::~LossyDctDecoderBase () {} void DwaCompressor::LossyDctDecoderBase::execute () { - int numComp = _rowPtrs.size(); + size_t numComp = _rowPtrs.size(); int lastNonZero = 0; int numBlocksX = (int) ceil ((float)_width / 8.0f); int numBlocksY = (int) ceil ((float)_height / 8.0f); @@ -743,7 +743,7 @@ DwaCompressor::LossyDctDecoderBase::execute () rowBlock[0] = (unsigned short *)(rowBlockHandle + i); } - for (int comp = 1; comp < numComp; ++comp) + for (size_t comp = 1; comp < numComp; ++comp) rowBlock[comp] = rowBlock[comp - 1] + numBlocksX * 64; // @@ -754,7 +754,7 @@ DwaCompressor::LossyDctDecoderBase::execute () currDcComp[0] = (unsigned short *)_packedDc; - for (unsigned int comp = 1; comp < numComp; ++comp) + for (size_t comp = 1; comp < numComp; ++comp) currDcComp[comp] = currDcComp[comp - 1] + numBlocksX * numBlocksY; for (int blocky = 0; blocky < numBlocksY; ++blocky) @@ -783,7 +783,7 @@ DwaCompressor::LossyDctDecoderBase::execute () bool blockIsConstant = true; - for (unsigned int comp = 0; comp < numComp; ++comp) + for (size_t comp = 0; comp < numComp; ++comp) { // @@ -939,7 +939,7 @@ DwaCompressor::LossyDctDecoderBase::execute () // If the block has a constant value, just convert the first pixel. // - for (unsigned int comp = 0; comp < numComp; ++comp) + for (size_t comp = 0; comp < numComp; ++comp) { if (!blockIsConstant) { @@ -995,7 +995,7 @@ DwaCompressor::LossyDctDecoderBase::execute () // * full 8-element wide blocks // - for (int comp = 0; comp < numComp; ++comp) + for (size_t comp = 0; comp < numComp; ++comp) { // // Test if we can use the fast path @@ -1137,7 +1137,7 @@ DwaCompressor::LossyDctDecoderBase::execute () // Convert from HALF XDR back to FLOAT XDR. // - for (unsigned int chan = 0; chan < numComp; ++chan) + for (size_t chan = 0; chan < numComp; ++chan) { if (_type[chan] != FLOAT) @@ -2340,8 +2340,9 @@ DwaCompressor::uncompress int minY = range.min.y; int maxY = std::min (range.max.y, _max[1]); - int headerSize = NUM_SIZES_SINGLE*sizeof(Int64); - if (inSize < headerSize) + Int64 iSize = static_cast( inSize ); + Int64 headerSize = NUM_SIZES_SINGLE*sizeof(Int64); + if (iSize < headerSize) { throw IEX_NAMESPACE::InputExc("Error uncompressing DWA data" "(truncated header)."); @@ -2387,11 +2388,11 @@ DwaCompressor::uncompress const char *dataPtr = inPtr + NUM_SIZES_SINGLE * sizeof(Int64); /* Both the sum and individual sizes are checked in case of overflow. */ - if (inSize < (headerSize + compressedSize) || - inSize < unknownCompressedSize || - inSize < acCompressedSize || - inSize < dcCompressedSize || - inSize < rleCompressedSize) + if (iSize < (headerSize + compressedSize) || + iSize < unknownCompressedSize || + iSize < acCompressedSize || + iSize < dcCompressedSize || + iSize < rleCompressedSize) { throw IEX_NAMESPACE::InputExc("Error uncompressing DWA data" "(truncated file)."); @@ -2423,7 +2424,7 @@ DwaCompressor::uncompress " (corrupt header file)."); headerSize += ruleSize; - if (inSize < headerSize + compressedSize) + if (iSize < headerSize + compressedSize) throw IEX_NAMESPACE::InputExc("Error uncompressing DWA data" " (truncated file)."); @@ -2446,9 +2447,9 @@ DwaCompressor::uncompress // Allocate _outBuffer, if we haven't done so already // - if (_maxScanLineSize * numScanLines() > _outBufferSize) + if (static_cast(_maxScanLineSize * numScanLines()) > _outBufferSize) { - _outBufferSize = _maxScanLineSize * numScanLines(); + _outBufferSize = static_cast(_maxScanLineSize * numScanLines()); if (_outBuffer != 0) delete[] _outBuffer; _outBuffer = new char[_maxScanLineSize * numScanLines()]; @@ -2594,9 +2595,9 @@ DwaCompressor::uncompress "(corrupt header)."); } - if (_zip->uncompress - (compressedDcBuf, (int)dcCompressedSize, _packedDcBuffer) - != (int)totalDcUncompressedCount * sizeof (unsigned short)) + if (static_cast(_zip->uncompress + (compressedDcBuf, (int)dcCompressedSize, _packedDcBuffer)) + != totalDcUncompressedCount * sizeof (unsigned short)) { throw IEX_NAMESPACE::BaseExc("DC data corrupt."); } @@ -2630,11 +2631,11 @@ DwaCompressor::uncompress if (dstLen != rleUncompressedSize) throw IEX_NAMESPACE::BaseExc("RLE data corrupted"); - if (rleUncompress + if (static_cast(rleUncompress ((int)rleUncompressedSize, (int)rleRawSize, (signed char *)_rleBuffer, - _planarUncBuffer[RLE]) != rleRawSize) + _planarUncBuffer[RLE])) != rleRawSize) { throw IEX_NAMESPACE::BaseExc("RLE data corrupted"); } @@ -2998,7 +2999,7 @@ DwaCompressor::initializeBuffers (size_t &outBufferSize) if (_zip == 0) _zip = new Zip (maxLossyDctDcSize * numLossyDctChans); - else if (_zip->maxRawSize() < maxLossyDctDcSize * numLossyDctChans) + else if (_zip->maxRawSize() < static_cast(maxLossyDctDcSize * numLossyDctChans)) { delete _zip; _zip = new Zip (maxLossyDctDcSize * numLossyDctChans); @@ -3035,7 +3036,7 @@ DwaCompressor::initializeBuffers (size_t &outBufferSize) // to Huffman encoding // - if (maxLossyDctAcSize * numLossyDctChans > _packedAcBufferSize) + if (static_cast(maxLossyDctAcSize * numLossyDctChans) > _packedAcBufferSize) { _packedAcBufferSize = maxLossyDctAcSize * numLossyDctChans; if (_packedAcBuffer != 0) @@ -3047,7 +3048,7 @@ DwaCompressor::initializeBuffers (size_t &outBufferSize) // _packedDcBuffer holds one quantized DCT coef per 8x8 block // - if (maxLossyDctDcSize * numLossyDctChans > _packedDcBufferSize) + if (static_cast(maxLossyDctDcSize * numLossyDctChans) > _packedDcBufferSize) { _packedDcBufferSize = maxLossyDctDcSize * numLossyDctChans; if (_packedDcBuffer != 0) @@ -3055,7 +3056,7 @@ DwaCompressor::initializeBuffers (size_t &outBufferSize) _packedDcBuffer = new char[_packedDcBufferSize]; } - if (rleBufferSize > _rleBufferSize) + if (static_cast(rleBufferSize) > _rleBufferSize) { _rleBufferSize = rleBufferSize; if (_rleBuffer != 0) @@ -3116,7 +3117,7 @@ DwaCompressor::initializeBuffers (size_t &outBufferSize) for (int i = 0; i < NUM_COMPRESSOR_SCHEMES; ++i) { - if (planarUncBufferSize[i] > _planarUncBufferSize[i]) + if (static_cast(planarUncBufferSize[i]) > _planarUncBufferSize[i]) { _planarUncBufferSize[i] = planarUncBufferSize[i]; if (_planarUncBuffer[i] != 0) diff --git a/OpenEXR/IlmImf/ImfFastHuf.cpp b/OpenEXR/IlmImf/ImfFastHuf.cpp index e581c0f25a..bbf2ed687c 100644 --- a/OpenEXR/IlmImf/ImfFastHuf.cpp +++ b/OpenEXR/IlmImf/ImfFastHuf.cpp @@ -125,7 +125,7 @@ FastHufDecoder::FastHufDecoder const int LONG_ZEROCODE_RUN = 63; const int SHORTEST_LONG_RUN = 2 + LONG_ZEROCODE_RUN - SHORT_ZEROCODE_RUN; - for (Int64 symbol = minSymbol; symbol <= maxSymbol; symbol++) + for (Int64 symbol = static_cast(minSymbol); symbol <= static_cast(maxSymbol); symbol++) { if (currByte - table > numBytes) { @@ -153,7 +153,7 @@ FastHufDecoder::FastHufDecoder int runLen = readBits (8, currBits, currBitCount, currByte) + SHORTEST_LONG_RUN; - if (symbol + runLen > maxSymbol + 1) + if (symbol + runLen > static_cast(maxSymbol + 1)) { throw IEX_NAMESPACE::InputExc ("Error decoding Huffman table " "(Run beyond end of table)."); @@ -162,11 +162,11 @@ FastHufDecoder::FastHufDecoder symbol += runLen - 1; } - else if (codeLen >= (Int64) SHORT_ZEROCODE_RUN) + else if (codeLen >= static_cast(SHORT_ZEROCODE_RUN)) { int runLen = codeLen - SHORT_ZEROCODE_RUN + 2; - if (symbol + runLen > maxSymbol + 1) + if (symbol + runLen > static_cast(maxSymbol + 1)) { throw IEX_NAMESPACE::InputExc ("Error decoding Huffman table " "(Run beyond end of table)."); @@ -255,7 +255,7 @@ FastHufDecoder::FastHufDecoder int codeLen = *i & 63; int symbol = *i >> 6; - if (mapping[codeLen] >= _numSymbols) + if (mapping[codeLen] >= static_cast(_numSymbols)) throw IEX_NAMESPACE::InputExc ("Huffman decode error " "(Invalid symbol in header)."); @@ -395,7 +395,7 @@ FastHufDecoder::buildTables (Int64 *base, Int64 *offset) _tableCodeLen[i] = codeLen; Int64 id = _ljOffset[codeLen] + (value >> (64 - codeLen)); - if (id < _numSymbols) + if (id < static_cast(_numSymbols)) { _tableSymbol[i] = _idToSymbol[id]; } @@ -667,7 +667,7 @@ FastHufDecoder::decode } Int64 id = _ljOffset[codeLen] + (buffer >> (64 - codeLen)); - if (id < _numSymbols) + if (id < static_cast(_numSymbols)) { symbol = _idToSymbol[id]; } diff --git a/OpenEXR/IlmImf/ImfHeader.cpp b/OpenEXR/IlmImf/ImfHeader.cpp index c0014bc569..bed894426e 100644 --- a/OpenEXR/IlmImf/ImfHeader.cpp +++ b/OpenEXR/IlmImf/ImfHeader.cpp @@ -822,7 +822,7 @@ Header::sanityCheck (bool isTiled, bool isMultipartFile) const // (only reachable for unknown types or damaged files: will have thrown earlier // for regular image types) if( maxImageHeight>0 && maxImageWidth>0 && - hasChunkCount() && chunkCount()>Int64(maxImageWidth)*Int64(maxImageHeight)) + hasChunkCount() && static_cast(chunkCount())>Int64(maxImageWidth)*Int64(maxImageHeight)) { THROW (IEX_NAMESPACE::ArgExc, "chunkCount exceeds maximum area of " << Int64(maxImageWidth)*Int64(maxImageHeight) << " pixels." ); diff --git a/OpenEXR/IlmImf/ImfMultiPartOutputFile.cpp b/OpenEXR/IlmImf/ImfMultiPartOutputFile.cpp index 8260cd223a..27add0c27f 100644 --- a/OpenEXR/IlmImf/ImfMultiPartOutputFile.cpp +++ b/OpenEXR/IlmImf/ImfMultiPartOutputFile.cpp @@ -498,7 +498,7 @@ MultiPartOutputFile::Data::writeChunkTableOffsets (vector &part Int64 pos = os->tellp(); - if (pos == -1) + if (pos == static_cast(-1)) IEX_NAMESPACE::throwErrnoExc ("Cannot determine current file position (%T)."); parts[i]->chunkOffsetTablePosition = os->tellp(); diff --git a/OpenEXR/IlmImf/ImfOutputFile.cpp b/OpenEXR/IlmImf/ImfOutputFile.cpp index ff44e66648..d30a55f270 100644 --- a/OpenEXR/IlmImf/ImfOutputFile.cpp +++ b/OpenEXR/IlmImf/ImfOutputFile.cpp @@ -255,7 +255,7 @@ writeLineOffsets (OPENEXR_IMF_INTERNAL_NAMESPACE::OStream &os, const vector(-1)) IEX_NAMESPACE::throwErrnoExc ("Cannot determine current file position (%T)."); for (unsigned int i = 0; i < lineOffsets.size(); i++) diff --git a/OpenEXR/IlmImf/ImfPizCompressor.cpp b/OpenEXR/IlmImf/ImfPizCompressor.cpp index 8b3ee38c3c..7a49d42d93 100644 --- a/OpenEXR/IlmImf/ImfPizCompressor.cpp +++ b/OpenEXR/IlmImf/ImfPizCompressor.cpp @@ -183,8 +183,9 @@ PizCompressor::PizCompressor _channels (hdr.channels()), _channelData (0) { - size_t tmpBufferSize = - uiMult (maxScanLineSize, numScanLines) / 2; + // TODO: Remove this when we can change the ABI + (void) _maxScanLineSize; + size_t tmpBufferSize = uiMult (maxScanLineSize, numScanLines) / 2; size_t outBufferSize = uiAdd (uiMult (maxScanLineSize, numScanLines), diff --git a/OpenEXR/IlmImf/ImfRgba.h b/OpenEXR/IlmImf/ImfRgba.h index dccba9f0ac..96a262de78 100644 --- a/OpenEXR/IlmImf/ImfRgba.h +++ b/OpenEXR/IlmImf/ImfRgba.h @@ -61,16 +61,6 @@ struct Rgba Rgba () {} Rgba (half r, half g, half b, half a = 1.f): r (r), g (g), b (b), a (a) {} - - Rgba & operator = (const Rgba &other) - { - r = other.r; - g = other.g; - b = other.b; - a = other.a; - - return *this; - } }; diff --git a/OpenEXR/IlmImf/ImfScanLineInputFile.cpp b/OpenEXR/IlmImf/ImfScanLineInputFile.cpp index 86bc0c0580..bc6985865a 100644 --- a/OpenEXR/IlmImf/ImfScanLineInputFile.cpp +++ b/OpenEXR/IlmImf/ImfScanLineInputFile.cpp @@ -535,7 +535,7 @@ LineBufferTask::execute () } if (_lineBuffer->compressor && - _lineBuffer->dataSize < uncompressedSize) + static_cast(_lineBuffer->dataSize) < uncompressedSize) { _lineBuffer->format = _lineBuffer->compressor->format(); @@ -849,7 +849,7 @@ LineBufferTaskIIF::execute() } if (_lineBuffer->compressor && - _lineBuffer->dataSize < uncompressedSize) + static_cast(_lineBuffer->dataSize) < uncompressedSize) { _lineBuffer->format = _lineBuffer->compressor->format(); diff --git a/OpenEXR/IlmImf/ImfTileOffsets.cpp b/OpenEXR/IlmImf/ImfTileOffsets.cpp index b0b40f637c..695076e710 100644 --- a/OpenEXR/IlmImf/ImfTileOffsets.cpp +++ b/OpenEXR/IlmImf/ImfTileOffsets.cpp @@ -279,7 +279,7 @@ TileOffsets::writeTo (OPENEXR_IMF_INTERNAL_NAMESPACE::OStream &os) const Int64 pos = os.tellp(); - if (pos == -1) + if (pos == static_cast(-1)) IEX_NAMESPACE::throwErrnoExc ("Cannot determine current file position (%T)."); for (unsigned int l = 0; l < _offsets.size(); ++l) diff --git a/OpenEXR/IlmImf/ImfTiledMisc.cpp b/OpenEXR/IlmImf/ImfTiledMisc.cpp index 17d6176415..d262f7347a 100644 --- a/OpenEXR/IlmImf/ImfTiledMisc.cpp +++ b/OpenEXR/IlmImf/ImfTiledMisc.cpp @@ -370,7 +370,7 @@ getTiledChunkOffsetTableSize(const Header& header) for (int i = 0; i < numXLevels; i++) { lineOffsetSize += static_cast(numXTiles[i]) * static_cast(numYTiles[i]); - if ( lineOffsetSize > std::numeric_limits::max() ) + if ( lineOffsetSize > static_cast(std::numeric_limits::max()) ) { throw IEX_NAMESPACE::LogicExc("Maximum number of tiles exceeded"); } @@ -382,7 +382,7 @@ getTiledChunkOffsetTableSize(const Header& header) for (int j = 0; j < numYLevels; j++) { lineOffsetSize += static_cast(numXTiles[i]) * static_cast(numYTiles[j]); - if ( lineOffsetSize > std::numeric_limits::max() ) + if ( lineOffsetSize > static_cast(std::numeric_limits::max()) ) { throw IEX_NAMESPACE::LogicExc("Maximum number of tiles exceeded"); } diff --git a/OpenEXR/IlmImf/ImfZipCompressor.cpp b/OpenEXR/IlmImf/ImfZipCompressor.cpp index b0d6989bb4..988549b5d3 100644 --- a/OpenEXR/IlmImf/ImfZipCompressor.cpp +++ b/OpenEXR/IlmImf/ImfZipCompressor.cpp @@ -60,7 +60,9 @@ ZipCompressor::ZipCompressor _outBuffer (0), _zip(maxScanLineSize, numScanLines) { - _outBuffer = new char[_zip.maxCompressedSize()]; + // TODO: Remove this when we can change the ABI + (void) _maxScanLineSize; + _outBuffer = new char[_zip.maxCompressedSize ()]; } @@ -124,4 +126,3 @@ ZipCompressor::uncompress (const char *inPtr, OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_EXIT - diff --git a/OpenEXR/IlmImf/dwaLookups.cpp b/OpenEXR/IlmImf/dwaLookups.cpp index 8d6f6c61b8..0a2a48d0fc 100644 --- a/OpenEXR/IlmImf/dwaLookups.cpp +++ b/OpenEXR/IlmImf/dwaLookups.cpp @@ -167,6 +167,7 @@ namespace { half inputHalf, closestHalf; inputHalf.setBits(input); + closestHalf.setBits(0); _offset[input - _startValue] = _numElements; diff --git a/OpenEXR/IlmImfExamples/drawImage.cpp b/OpenEXR/IlmImfExamples/drawImage.cpp index a27062fabe..e0dd61c6b3 100644 --- a/OpenEXR/IlmImfExamples/drawImage.cpp +++ b/OpenEXR/IlmImfExamples/drawImage.cpp @@ -144,11 +144,6 @@ zsp (Array2D &gpx, Array2D &zpx, int w, int h, if (r >= 1) continue; - float a = 1; - - if (r * rc > rc - 1) - a = rc - r * rc; - float zl = sqrt (1 - r * r); float zp = zc - rc * zl; diff --git a/OpenEXR/IlmImfExamples/lowLevelIoExamples.cpp b/OpenEXR/IlmImfExamples/lowLevelIoExamples.cpp index 8e52e96f00..c48ac345bc 100644 --- a/OpenEXR/IlmImfExamples/lowLevelIoExamples.cpp +++ b/OpenEXR/IlmImfExamples/lowLevelIoExamples.cpp @@ -98,18 +98,18 @@ class C_OStream: public OStream bool C_IStream::read (char c[/*n*/], int n) { - if (n != fread (c, 1, n, _file)) + if (n != static_cast(fread (c, 1, n, _file))) { - // - // fread() failed, but the return value does not distinguish - // between I/O errors and end of file, so we call ferror() to - // determine what happened. - // - - if (ferror (_file)) - IEX_NAMESPACE::throwErrnoExc(); - else - throw IEX_NAMESPACE::InputExc ("Unexpected end of file."); + // + // fread() failed, but the return value does not distinguish + // between I/O errors and end of file, so we call ferror() to + // determine what happened. + // + + if (ferror (_file)) + IEX_NAMESPACE::throwErrnoExc(); + else + throw IEX_NAMESPACE::InputExc ("Unexpected end of file."); } return feof (_file); @@ -143,8 +143,8 @@ C_OStream::write (const char c[/*n*/], int n) { clearerr (_file); - if (n != fwrite (c, 1, n, _file)) - IEX_NAMESPACE::throwErrnoExc(); + if (n != static_cast(fwrite (c, 1, n, _file))) + IEX_NAMESPACE::throwErrnoExc(); } diff --git a/OpenEXR/IlmImfExamples/rgbaInterfaceExamples.cpp b/OpenEXR/IlmImfExamples/rgbaInterfaceExamples.cpp index 4c0ce2f433..625c2ddaf8 100644 --- a/OpenEXR/IlmImfExamples/rgbaInterfaceExamples.cpp +++ b/OpenEXR/IlmImfExamples/rgbaInterfaceExamples.cpp @@ -180,7 +180,7 @@ readRgba2 (const char fileName[]) Box2i dw = file.dataWindow(); int width = dw.max.x - dw.min.x + 1; - int height = dw.max.y - dw.min.y + 1; + Array2D pixels (10, width); while (dw.min.y <= dw.max.y) diff --git a/OpenEXR/IlmImfFuzzTest/fuzzFile.cpp b/OpenEXR/IlmImfFuzzTest/fuzzFile.cpp index f7d3b3385f..e7d0ff027f 100644 --- a/OpenEXR/IlmImfFuzzTest/fuzzFile.cpp +++ b/OpenEXR/IlmImfFuzzTest/fuzzFile.cpp @@ -32,6 +32,9 @@ // /////////////////////////////////////////////////////////////////////////// +#ifdef NDEBUG +# undef NDEBUG +#endif #include diff --git a/OpenEXR/IlmImfFuzzTest/main.cpp b/OpenEXR/IlmImfFuzzTest/main.cpp index 280e7541a6..0b7342f1e9 100644 --- a/OpenEXR/IlmImfFuzzTest/main.cpp +++ b/OpenEXR/IlmImfFuzzTest/main.cpp @@ -32,6 +32,9 @@ // /////////////////////////////////////////////////////////////////////////// +#ifdef NDEBUG +# undef NDEBUG +#endif #include "ImfNamespace.h" #include "OpenEXRConfigInternal.h" diff --git a/OpenEXR/IlmImfFuzzTest/testFuzzDeepScanLines.cpp b/OpenEXR/IlmImfFuzzTest/testFuzzDeepScanLines.cpp index 1f5e6bf506..945ffacc52 100644 --- a/OpenEXR/IlmImfFuzzTest/testFuzzDeepScanLines.cpp +++ b/OpenEXR/IlmImfFuzzTest/testFuzzDeepScanLines.cpp @@ -32,7 +32,9 @@ // /////////////////////////////////////////////////////////////////////////// - +#ifdef NDEBUG +# undef NDEBUG +#endif #include "fuzzFile.h" @@ -174,7 +176,7 @@ void generateRandomFile(const char filename[], int channelCount,int parts , Comp for (int k = 0; k < channelCount; k++) { data[k][i][j] = new float[sampleCount[i][j]]; - for (int l = 0; l < sampleCount[i][j]; l++) + for (unsigned int l = 0; l < sampleCount[i][j]; l++) { ((float*)data[k][i][j])[l] = (i * width + j) % 2049; } @@ -247,8 +249,6 @@ void readFile(const char filename[]) file.readPixelSampleCounts(dataWindow.min.y, dataWindow.max.y); for (int i = 0; i < dataWindow.max.y - dataWindow.min.y + 1; i++) { - int y = i + dataWindow.min.y; - for (int j = 0; j < width; j++) { for (int k = 0; k < channelCount; k++) @@ -340,8 +340,6 @@ void readFile(const char filename[]) inpart.readPixelSampleCounts(dataWindow.min.y, dataWindow.max.y); for (int i = 0; i < dataWindow.max.y - dataWindow.min.y + 1; i++) { - int y = i + dataWindow.min.y; - for (int j = 0; j < width; j++) { for (int k = 0; k < channelCount; k++) diff --git a/OpenEXR/IlmImfFuzzTest/testFuzzDeepTiles.cpp b/OpenEXR/IlmImfFuzzTest/testFuzzDeepTiles.cpp index f45c0b8ba2..835008ef72 100644 --- a/OpenEXR/IlmImfFuzzTest/testFuzzDeepTiles.cpp +++ b/OpenEXR/IlmImfFuzzTest/testFuzzDeepTiles.cpp @@ -32,7 +32,9 @@ // /////////////////////////////////////////////////////////////////////////// - +#ifdef NDEBUG +# undef NDEBUG +#endif #include "fuzzFile.h" @@ -198,7 +200,7 @@ void generateRandomFile(const char filename[], int channelCount, int parts , Com for (int k = 0; k < channelCount; k++) { data[k][dwy][dwx] = new float[sampleCount[dwy][dwx]]; - for (int l = 0; l < sampleCount[dwy][dwx]; l++) + for (unsigned int l = 0; l < sampleCount[dwy][dwx]; l++) { ((float*)data[k][dwy][dwx])[l] = (dwy * width + dwx) % 2049; } diff --git a/OpenEXR/IlmImfFuzzTest/testFuzzScanLines.cpp b/OpenEXR/IlmImfFuzzTest/testFuzzScanLines.cpp index c0418c7139..c5de62231d 100644 --- a/OpenEXR/IlmImfFuzzTest/testFuzzScanLines.cpp +++ b/OpenEXR/IlmImfFuzzTest/testFuzzScanLines.cpp @@ -32,8 +32,9 @@ // /////////////////////////////////////////////////////////////////////////// - - +#ifdef NDEBUG +# undef NDEBUG +#endif #include #include diff --git a/OpenEXR/IlmImfFuzzTest/testFuzzTiles.cpp b/OpenEXR/IlmImfFuzzTest/testFuzzTiles.cpp index 83f50e14bb..a48a11a4a4 100644 --- a/OpenEXR/IlmImfFuzzTest/testFuzzTiles.cpp +++ b/OpenEXR/IlmImfFuzzTest/testFuzzTiles.cpp @@ -32,6 +32,9 @@ // /////////////////////////////////////////////////////////////////////////// +#ifdef NDEBUG +# undef NDEBUG +#endif #include #include diff --git a/OpenEXR/IlmImfTest/compareB44.cpp b/OpenEXR/IlmImfTest/compareB44.cpp index 963f4f1ae4..ebc5d2e49e 100644 --- a/OpenEXR/IlmImfTest/compareB44.cpp +++ b/OpenEXR/IlmImfTest/compareB44.cpp @@ -36,6 +36,10 @@ // ////////////////////////////////////////////////////////////////////////////// +#ifdef NDEBUG +# undef NDEBUG +#endif + #include "compareB44.h" #include diff --git a/OpenEXR/IlmImfTest/compareDwa.cpp b/OpenEXR/IlmImfTest/compareDwa.cpp index f64c746aaf..9cc637fb6c 100644 --- a/OpenEXR/IlmImfTest/compareDwa.cpp +++ b/OpenEXR/IlmImfTest/compareDwa.cpp @@ -31,6 +31,10 @@ // /////////////////////////////////////////////////////////////////////////// +#ifdef NDEBUG +# undef NDEBUG +#endif + #include #include diff --git a/OpenEXR/IlmImfTest/compareFloat.cpp b/OpenEXR/IlmImfTest/compareFloat.cpp index 179dfa4167..a67b51865a 100644 --- a/OpenEXR/IlmImfTest/compareFloat.cpp +++ b/OpenEXR/IlmImfTest/compareFloat.cpp @@ -36,6 +36,10 @@ // ////////////////////////////////////////////////////////////////////////////// +#ifdef NDEBUG +# undef NDEBUG +#endif + #include "compareFloat.h" using namespace OPENEXR_IMF_NAMESPACE; diff --git a/OpenEXR/IlmImfTest/main.cpp b/OpenEXR/IlmImfTest/main.cpp index 8803679c59..5d5c5365e8 100644 --- a/OpenEXR/IlmImfTest/main.cpp +++ b/OpenEXR/IlmImfTest/main.cpp @@ -32,6 +32,9 @@ // /////////////////////////////////////////////////////////////////////////// +#ifdef NDEBUG +# undef NDEBUG +#endif #include "ImfNamespace.h" #include "OpenEXRConfigInternal.h" diff --git a/OpenEXR/IlmImfTest/testAttributes.cpp b/OpenEXR/IlmImfTest/testAttributes.cpp index 71ce1748ef..e506273b38 100644 --- a/OpenEXR/IlmImfTest/testAttributes.cpp +++ b/OpenEXR/IlmImfTest/testAttributes.cpp @@ -32,7 +32,9 @@ // /////////////////////////////////////////////////////////////////////////// - +#ifdef NDEBUG +# undef NDEBUG +#endif #include diff --git a/OpenEXR/IlmImfTest/testBackwardCompatibility.cpp b/OpenEXR/IlmImfTest/testBackwardCompatibility.cpp index 4335d78931..9d4b921c9b 100644 --- a/OpenEXR/IlmImfTest/testBackwardCompatibility.cpp +++ b/OpenEXR/IlmImfTest/testBackwardCompatibility.cpp @@ -32,6 +32,10 @@ // /////////////////////////////////////////////////////////////////////////// +#ifdef NDEBUG +# undef NDEBUG +#endif + #include "testBackwardCompatibility.h" #include @@ -118,6 +122,7 @@ diffImageFiles (const char * fn1, const char * fn2) } } +#if 0 void addPreviewImageToHeader (OPENEXR_IMF_NAMESPACE::Header & hdr) { @@ -134,6 +139,7 @@ addPreviewImageToHeader (OPENEXR_IMF_NAMESPACE::Header & hdr) } hdr.setPreviewImage (OPENEXR_IMF_NAMESPACE::PreviewImage (pW, pH, &previewPixels[0][0])); } +#endif void addUserAttributesToHeader (OPENEXR_IMF_NAMESPACE::Header & hdr) diff --git a/OpenEXR/IlmImfTest/testBadTypeAttributes.cpp b/OpenEXR/IlmImfTest/testBadTypeAttributes.cpp index 31a9d51f1a..634fca9397 100644 --- a/OpenEXR/IlmImfTest/testBadTypeAttributes.cpp +++ b/OpenEXR/IlmImfTest/testBadTypeAttributes.cpp @@ -32,6 +32,10 @@ // /////////////////////////////////////////////////////////////////////////// +#ifdef NDEBUG +# undef NDEBUG +#endif + #include "ImfInputFile.h" #include "ImfInputPart.h" #include "ImfTiledInputFile.h" @@ -115,7 +119,7 @@ template void readTiledThing(T & input,bool test) case ONE_LEVEL : x_levels = 1; y_levels = 1; - break; + break; case MIPMAP_LEVELS : x_levels = input.numXLevels(); y_levels = 1; @@ -123,14 +127,15 @@ template void readTiledThing(T & input,bool test) case RIPMAP_LEVELS : x_levels = input.numXLevels(); y_levels = input.numYLevels(); - break; - case NUM_LEVELMODES: - default: - std::cerr << "Invalid tile mode " << int(t.mode) << std::endl; - break; + break; + case NUM_LEVELMODES: + default: + std::cerr << "Invalid tile mode " << int(t.mode) << std::endl; + x_levels = y_levels = 0; + break; } - for(int x_level = 0 ; x_level < x_levels ; x_level++) + for(int x_level = 0 ; x_level < x_levels ; x_level++) { for(int y_level = 0 ; y_level < y_levels ;y_level++) { @@ -409,4 +414,3 @@ void testBadTypeAttributes(const std::string & tempDir) cout << "ok\n" << endl; } - diff --git a/OpenEXR/IlmImfTest/testChannels.cpp b/OpenEXR/IlmImfTest/testChannels.cpp index 45a93a396e..129e4be875 100644 --- a/OpenEXR/IlmImfTest/testChannels.cpp +++ b/OpenEXR/IlmImfTest/testChannels.cpp @@ -32,7 +32,9 @@ // /////////////////////////////////////////////////////////////////////////// - +#ifdef NDEBUG +# undef NDEBUG +#endif #include #include diff --git a/OpenEXR/IlmImfTest/testCompositeDeepScanLine.cpp b/OpenEXR/IlmImfTest/testCompositeDeepScanLine.cpp index 89f03442cc..39547508be 100644 --- a/OpenEXR/IlmImfTest/testCompositeDeepScanLine.cpp +++ b/OpenEXR/IlmImfTest/testCompositeDeepScanLine.cpp @@ -31,6 +31,10 @@ // /////////////////////////////////////////////////////////////////////////// +#ifdef NDEBUG +# undef NDEBUG +#endif + #include "testCompositeDeepScanLine.h" #include @@ -245,7 +249,7 @@ class data { // copy sample to a random part - for(int s=0;s<_samples[i].size();s++) + for(size_t s=0;s<_samples[i].size();s++) { int part = rand()% parts.size(); parts[part]._samples[i].push_back(_samples[i][s]); @@ -452,7 +456,6 @@ make_pattern(data & bob,int pattern_number) // set channels bob << string("Z") << string("ZBack") << string("A") << string("R"); - PixelType t; // regular two-pixel composite bob << 1.0 << 2.0 << 0.0 << 1.0 << end(); diff --git a/OpenEXR/IlmImfTest/testCompression.cpp b/OpenEXR/IlmImfTest/testCompression.cpp index aad9cf69cf..0be116c189 100644 --- a/OpenEXR/IlmImfTest/testCompression.cpp +++ b/OpenEXR/IlmImfTest/testCompression.cpp @@ -32,6 +32,9 @@ // /////////////////////////////////////////////////////////////////////////// +#ifdef NDEBUG +# undef NDEBUG +#endif #include "compareB44.h" diff --git a/OpenEXR/IlmImfTest/testConversion.cpp b/OpenEXR/IlmImfTest/testConversion.cpp index 7e5db5c84a..f8fecd4e73 100644 --- a/OpenEXR/IlmImfTest/testConversion.cpp +++ b/OpenEXR/IlmImfTest/testConversion.cpp @@ -36,6 +36,9 @@ // ////////////////////////////////////////////////////////////////////////////// +#ifdef NDEBUG +# undef NDEBUG +#endif #include #include diff --git a/OpenEXR/IlmImfTest/testCopyDeepScanLine.cpp b/OpenEXR/IlmImfTest/testCopyDeepScanLine.cpp index 2d67a3504f..97040484c8 100644 --- a/OpenEXR/IlmImfTest/testCopyDeepScanLine.cpp +++ b/OpenEXR/IlmImfTest/testCopyDeepScanLine.cpp @@ -34,6 +34,10 @@ // /////////////////////////////////////////////////////////////////////////// +#ifdef NDEBUG +# undef NDEBUG +#endif + #include "testCopyDeepScanLine.h" @@ -68,8 +72,6 @@ const int minX = 42; const int minY = 51; const Box2i dataWindow(V2i(minX, minY), V2i(minX + width - 1, minY + height - 1)); const Box2i displayWindow(V2i(0, 0), V2i(minX + width * 2, minY + height * 2)); -const char source_filename[] = IMF_TMP_DIR "imf_test_copy_deep_scanline_source.exr"; -const char copy_filename[] = IMF_TMP_DIR "imf_test_copy_deep_scanline_copy.exr"; vector channelTypes; Array2D sampleCount; @@ -132,7 +134,7 @@ void generateRandomFile (const std::string & source_filename, for (int i = 0; i < channelCount; i++) { - PixelType type; + PixelType type = NUM_PIXELTYPES; if (channelTypes[i] == 0) type = IMF::UINT; if (channelTypes[i] == 1) @@ -144,7 +146,7 @@ void generateRandomFile (const std::string & source_filename, ss << i; string str = ss.str(); - int sampleSize; + int sampleSize = 0; if (channelTypes[i] == 0) sampleSize = sizeof (unsigned int); if (channelTypes[i] == 1) sampleSize = sizeof (half); if (channelTypes[i] == 2) sampleSize = sizeof (float); @@ -181,7 +183,7 @@ void generateRandomFile (const std::string & source_filename, data[k][i][j] = new half[sampleCount[i][j]]; if (channelTypes[k] == 2) data[k][i][j] = new float[sampleCount[i][j]]; - for (int l = 0; l < sampleCount[i][j]; l++) + for (unsigned int l = 0; l < sampleCount[i][j]; l++) { if (channelTypes[k] == 0) ((unsigned int*)data[k][i][j])[l] = (i * width + j) % 2049; @@ -265,7 +267,7 @@ void readFile (const std::string & copy_filename, int channelCount) for (int i = 0; i < channelCount; i++) { - PixelType type; + PixelType type = NUM_PIXELTYPES; if (channelTypes[i] == 0) type = IMF::UINT; if (channelTypes[i] == 1) @@ -277,7 +279,7 @@ void readFile (const std::string & copy_filename, int channelCount) ss << i; string str = ss.str(); - int sampleSize; + int sampleSize = 0; if (channelTypes[i] == 0) sampleSize = sizeof (unsigned int); if (channelTypes[i] == 1) sampleSize = sizeof (half); if (channelTypes[i] == 2) sampleSize = sizeof (float); @@ -302,8 +304,6 @@ void readFile (const std::string & copy_filename, int channelCount) file.readPixelSampleCounts(dataWindow.min.y, dataWindow.max.y); for (int i = 0; i < dataWindow.max.y - dataWindow.min.y + 1; i++) { - int y = i + dataWindow.min.y; - for (int j = 0; j < width; j++) assert(localSampleCount[i][j] == sampleCount[i][j]); @@ -328,21 +328,21 @@ void readFile (const std::string & copy_filename, int channelCount) for (int j = 0; j < width; j++) for (int k = 0; k < channelCount; k++) { - for (int l = 0; l < sampleCount[i][j]; l++) + for (unsigned int l = 0; l < sampleCount[i][j]; l++) { if (channelTypes[k] == 0) { unsigned int* value = (unsigned int*)(data[k][i][j]); - if (value[l] != (i * width + j) % 2049) + if (value[l] != static_cast(i * width + j) % 2049) cout << j << ", " << i << " error, should be " << (i * width + j) % 2049 << ", is " << value[l] << endl << flush; - assert (value[l] == (i * width + j) % 2049); + assert (value[l] == static_cast(i * width + j) % 2049); } if (channelTypes[k] == 1) { half* value = (half*)(data[k][i][j]); - if (value[l] != (i * width + j) % 2049) + if (value[l] != static_cast(i * width + j) % 2049) cout << j << ", " << i << " error, should be " << (i * width + j) % 2049 << ", is " << value[l] << endl << flush; diff --git a/OpenEXR/IlmImfTest/testCopyDeepTiled.cpp b/OpenEXR/IlmImfTest/testCopyDeepTiled.cpp index 332c8fa264..a6823408ed 100644 --- a/OpenEXR/IlmImfTest/testCopyDeepTiled.cpp +++ b/OpenEXR/IlmImfTest/testCopyDeepTiled.cpp @@ -32,6 +32,10 @@ // /////////////////////////////////////////////////////////////////////////// +#ifdef NDEBUG +# undef NDEBUG +#endif + #include "testCopyDeepTiled.h" @@ -145,7 +149,7 @@ generateRandomFile (int channelCount, for (int i = 0; i < channelCount; i++) { - PixelType type; + PixelType type = NUM_PIXELTYPES; if (channelTypes[i] == 0) type = IMF::UINT; if (channelTypes[i] == 1) @@ -157,7 +161,7 @@ generateRandomFile (int channelCount, ss << i; string str = ss.str(); - int sampleSize; + int sampleSize = 0; if (channelTypes[i] == 0) sampleSize = sizeof (unsigned int); if (channelTypes[i] == 1) sampleSize = sizeof (half); if (channelTypes[i] == 2) sampleSize = sizeof (float); @@ -209,7 +213,7 @@ generateRandomFile (int channelCount, data[k][dwy][dwx] = new half[sampleCount[dwy][dwx]]; if (channelTypes[k] == 2) data[k][dwy][dwx] = new float[sampleCount[dwy][dwx]]; - for (int l = 0; l < sampleCount[dwy][dwx]; l++) + for (unsigned int l = 0; l < sampleCount[dwy][dwx]; l++) { if (channelTypes[k] == 0) ((unsigned int*)data[k][dwy][dwx])[l] = (dwy * width + dwx) % 2049; @@ -240,6 +244,7 @@ generateRandomFile (int channelCount, } } +#if 0 void checkValue (void* sampleRawData, int sampleCount, int channelType, int dwx, int dwy) { @@ -274,6 +279,7 @@ checkValue (void* sampleRawData, int sampleCount, int channelType, int dwx, int } } } +#endif void readFile (int channelCount, const std::string & cpyFn) @@ -315,7 +321,7 @@ readFile (int channelCount, const std::string & cpyFn) for (int i = 0; i < channelCount; i++) { - PixelType type; + PixelType type = NUM_PIXELTYPES; if (channelTypes[i] == 0) type = IMF::UINT; if (channelTypes[i] == 1) @@ -327,7 +333,7 @@ readFile (int channelCount, const std::string & cpyFn) ss << i; string str = ss.str(); - int sampleSize; + int sampleSize = 0; if (channelTypes[i] == 0) sampleSize = sizeof (unsigned int); if (channelTypes[i] == 1) sampleSize = sizeof (half); if (channelTypes[i] == 2) sampleSize = sizeof (float); @@ -372,7 +378,7 @@ readFile (int channelCount, const std::string & cpyFn) int dwx = x - dataWindowL.min.x; assert(localSampleCount[dwy][dwx] == sampleCountWhole[ly][lx][dwy][dwx]); - for (int k = 0; k < channelTypes.size(); k++) + for (size_t k = 0; k < channelTypes.size(); k++) { if (channelTypes[k] == 0) data[k][dwy][dwx] = new unsigned int[localSampleCount[dwy][dwx]]; @@ -392,16 +398,16 @@ readFile (int channelCount, const std::string & cpyFn) for (int j = 0; j < file.levelWidth(lx); j++) for (int k = 0; k < channelCount; k++) { - for (int l = 0; l < localSampleCount[i][j]; l++) + for (unsigned int l = 0; l < localSampleCount[i][j]; l++) { if (channelTypes[k] == 0) { unsigned int* value = (unsigned int*)(data[k][i][j]); - if (value[l] != (i * width + j) % 2049) + if (value[l] != static_cast(i * width + j) % 2049) cout << j << ", " << i << " error, should be " << (i * width + j) % 2049 << ", is " << value[l] << endl << flush; - assert (value[l] == (i * width + j) % 2049); + assert (value[l] == static_cast(i * width + j) % 2049); } if (channelTypes[k] == 1) { diff --git a/OpenEXR/IlmImfTest/testCopyMultiPartFile.cpp b/OpenEXR/IlmImfTest/testCopyMultiPartFile.cpp index 69881ede3b..cb65c8e1f5 100644 --- a/OpenEXR/IlmImfTest/testCopyMultiPartFile.cpp +++ b/OpenEXR/IlmImfTest/testCopyMultiPartFile.cpp @@ -34,6 +34,10 @@ // /////////////////////////////////////////////////////////////////////////// +#ifdef NDEBUG +# undef NDEBUG +#endif + #include #include #include @@ -100,7 +104,7 @@ void fillPixels (Array2D& sampleCount, Array2D &ph, int width, for (int x = 0; x < width; ++x) { ph[y][x] = new T[sampleCount[y][x]]; - for (int i = 0; i < sampleCount[y][x]; i++) + for (unsigned int i = 0; i < sampleCount[y][x]; i++) { // // We do this because half cannot store number bigger than 2048 exactly. @@ -159,7 +163,7 @@ bool checkPixels (Array2D &ph, int lx, int rx, int ly, int ry, int width) { for (int y = ly; y <= ry; ++y) for (int x = lx; x <= rx; ++x) - if (ph[y][x] != (y * width + x) % 2049) + if (ph[y][x] != static_cast(((y * width + x) % 2049))) { cout << "value at " << x << ", " << y << ": " << ph[y][x] << ", should be " << (y * width + x) % 2049 << endl << flush; @@ -181,9 +185,9 @@ bool checkPixels (Array2D& sampleCount, Array2D &ph, for (int y = ly; y <= ry; ++y) for (int x = lx; x <= rx; ++x) { - for (int i = 0; i < sampleCount[y][x]; i++) + for (unsigned int i = 0; i < sampleCount[y][x]; i++) { - if (ph[y][x][i] != (y * width + x) % 2049) + if (ph[y][x][i] != static_cast(((y * width + x) % 2049))) { cout << "value at " << x << ", " << y << ", sample " << i << ": " << ph[y][x][i] << ", should be " << (y * width + x) % 2049 << endl << flush; @@ -200,6 +204,7 @@ bool checkPixels (Array2D& sampleCount, Array2D &ph, int width return checkPixels (sampleCount, ph, 0, width - 1, 0, height - 1, width); } +#if 0 bool checkSampleCount(Array2D& sampleCount, int x1, int x2, int y1, int y2, int width) { for (int i = y1; i <= y2; i++) @@ -215,10 +220,12 @@ bool checkSampleCount(Array2D& sampleCount, int x1, int x2, int y1 return true; } + bool checkSampleCount(Array2D& sampleCount, int width, int height) { return checkSampleCount(sampleCount, 0, width - 1, 0, height - 1, width); } +#endif void generateRandomHeaders(int partCount, vector
& headers) { @@ -283,7 +290,7 @@ void generateRandomHeaders(int partCount, vector
& headers) tileY = rand() % height + 1; levelMode = rand() % 3; levelModes[i] = levelMode; - LevelMode lm; + LevelMode lm = NUM_LEVELMODES; switch (levelMode) { case 0: @@ -306,7 +313,7 @@ void generateRandomHeaders(int partCount, vector
& headers) // can't write random scanlines order = rand() % (NUM_LINEORDERS-1); } - LineOrder l; + LineOrder l = NUM_LINEORDERS; switch(order) { case 0 : @@ -671,7 +678,7 @@ readWholeFiles (const std::string & cpyFn) Array2D sampleCount; MultiPartInputFile file(cpyFn.c_str()); - for (size_t i = 0; i < file.parts(); i++) + for (int i = 0; i < file.parts(); i++) { const Header& header = file.header(i); assert (header.displayWindow() == headers[i].displayWindow()); @@ -692,12 +699,13 @@ readWholeFiles (const std::string & cpyFn) // Shuffle part numbers. // vector shuffledPartNumber; - for (int i = 0; i < headers.size(); i++) + int nHeaders = static_cast(headers.size()); + for (int i = 0; i < nHeaders; i++) shuffledPartNumber.push_back(i); - for (int i = 0; i < headers.size(); i++) + for (int i = 0; i < nHeaders; i++) { - int a = rand() % headers.size(); - int b = rand() % headers.size(); + int a = rand() % nHeaders; + int b = rand() % nHeaders; swap (shuffledPartNumber[a], shuffledPartNumber[b]); } @@ -708,7 +716,7 @@ readWholeFiles (const std::string & cpyFn) int partNumber; try { - for (i = 0; i < headers.size(); i++) + for (i = 0; i < nHeaders; i++) { partNumber = shuffledPartNumber[i]; switch (partTypes[partNumber]) @@ -897,7 +905,7 @@ copyFile (const std::string & srcFn, const std::string & cpyFn) } MultiPartOutputFile out(cpyFn.c_str(),&in_hdr[0],in.parts()); - for(size_t i=0;i #include diff --git a/OpenEXR/IlmImfTest/testCustomAttributes.cpp b/OpenEXR/IlmImfTest/testCustomAttributes.cpp index 091b10744e..87120405a1 100644 --- a/OpenEXR/IlmImfTest/testCustomAttributes.cpp +++ b/OpenEXR/IlmImfTest/testCustomAttributes.cpp @@ -32,6 +32,9 @@ // /////////////////////////////////////////////////////////////////////////// +#ifdef NDEBUG +# undef NDEBUG +#endif #include #include diff --git a/OpenEXR/IlmImfTest/testDeepScanLineBasic.cpp b/OpenEXR/IlmImfTest/testDeepScanLineBasic.cpp index 2793083863..3ebbee8993 100644 --- a/OpenEXR/IlmImfTest/testDeepScanLineBasic.cpp +++ b/OpenEXR/IlmImfTest/testDeepScanLineBasic.cpp @@ -32,6 +32,10 @@ // /////////////////////////////////////////////////////////////////////////// +#ifdef NDEBUG +# undef NDEBUG +#endif + #include "testDeepScanLineBasic.h" @@ -127,7 +131,7 @@ void generateRandomFile (const std::string filename, for (int i = 0; i < channelCount; i++) { - PixelType type; + PixelType type = NUM_PIXELTYPES; if (channelTypes[i] == 0) type = IMF::UINT; if (channelTypes[i] == 1) @@ -139,7 +143,7 @@ void generateRandomFile (const std::string filename, ss << i; string str = ss.str(); - int sampleSize; + int sampleSize = 0; if (channelTypes[i] == 0) sampleSize = sizeof (unsigned int); if (channelTypes[i] == 1) sampleSize = sizeof (half); if (channelTypes[i] == 2) sampleSize = sizeof (float); @@ -179,7 +183,7 @@ void generateRandomFile (const std::string filename, data[k][i][j] = new half[sampleCount[i][j]]; if (channelTypes[k] == 2) data[k][i][j] = new float[sampleCount[i][j]]; - for (int l = 0; l < sampleCount[i][j]; l++) + for (unsigned int l = 0; l < sampleCount[i][j]; l++) { if (channelTypes[k] == 0) ((unsigned int*)data[k][i][j])[l] = (i * width + j) % 2049; @@ -214,7 +218,7 @@ void generateRandomFile (const std::string filename, data[k][i][j] = new half[sampleCount[i][j]]; if (channelTypes[k] == 2) data[k][i][j] = new float[sampleCount[i][j]]; - for (int l = 0; l < sampleCount[i][j]; l++) + for (unsigned int l = 0; l < sampleCount[i][j]; l++) { if (channelTypes[k] == 0) ((unsigned int*)data[k][i][j])[l] = (i * width + j) % 2049; @@ -298,7 +302,7 @@ void readFile (const std::string & filename, } if(!randomChannels || read_channel[i]==1) { - PixelType type; + PixelType type = NUM_PIXELTYPES; if (channelTypes[i] == 0) type = IMF::UINT; if (channelTypes[i] == 1) @@ -310,7 +314,7 @@ void readFile (const std::string & filename, ss << i; string str = ss.str(); - int sampleSize; + int sampleSize = 0; if (channelTypes[i] == 0) sampleSize = sizeof (unsigned int); if (channelTypes[i] == 1) sampleSize = sizeof (half); if (channelTypes[i] == 2) sampleSize = sizeof (float); @@ -344,8 +348,6 @@ void readFile (const std::string & filename, file.readPixelSampleCounts(dataWindow.min.y, dataWindow.max.y); for (int i = 0; i < dataWindow.max.y - dataWindow.min.y + 1; i++) { - int y = i + dataWindow.min.y; - for (int j = 0; j < width; j++) assert(localSampleCount[i][j] == sampleCount[i][j]); @@ -407,16 +409,16 @@ void readFile (const std::string & filename, { if( !randomChannels || read_channel[k]==1 ) { - for (int l = 0; l < sampleCount[i][j]; l++) + for (unsigned int l = 0; l < sampleCount[i][j]; l++) { if (channelTypes[k] == 0) { unsigned int* value = (unsigned int*)(data[k][i][j]); - if (value[l] != (i * width + j) % 2049) + if (value[l] != static_cast(i * width + j) % 2049) cout << j << ", " << i << " error, should be " << (i * width + j) % 2049 << ", is " << value[l] << endl << flush; - assert (value[l] == (i * width + j) % 2049); + assert (value[l] == static_cast(i * width + j) % 2049); } if (channelTypes[k] == 1) { diff --git a/OpenEXR/IlmImfTest/testDeepScanLineHuge.cpp b/OpenEXR/IlmImfTest/testDeepScanLineHuge.cpp index 88877892c5..a417b5bacc 100644 --- a/OpenEXR/IlmImfTest/testDeepScanLineHuge.cpp +++ b/OpenEXR/IlmImfTest/testDeepScanLineHuge.cpp @@ -32,6 +32,10 @@ // /////////////////////////////////////////////////////////////////////////// +#ifdef NDEBUG +# undef NDEBUG +#endif + #include "testDeepScanLineBasic.h" #include "ImfDeepScanLineInputFile.h" @@ -136,7 +140,7 @@ generateRandomFile (int channelCount, Int64 bytes_per_sample = 0; for (int i = 0; i < channelCount; i++) { - PixelType type; + PixelType type = NUM_PIXELTYPES; if (channelTypes[i] == 0) type = IMF::UINT; if (channelTypes[i] == 1) @@ -148,7 +152,7 @@ generateRandomFile (int channelCount, ss << i; string str = ss.str(); - int sampleSize; + int sampleSize = 0; if (channelTypes[i] == 0) sampleSize = sizeof (unsigned int); if (channelTypes[i] == 1) sampleSize = sizeof (half); if (channelTypes[i] == 2) sampleSize = sizeof (float); @@ -228,7 +232,7 @@ generateRandomFile (int channelCount, if(random_channel_data) { - for (int l = 0; l < sampleCount[i][j]; l++) + for (unsigned int l = 0; l < sampleCount[i][j]; l++) { if (channelTypes[k] == 0) ((unsigned int*)data[k][i][j])[l] = rand(); @@ -240,7 +244,7 @@ generateRandomFile (int channelCount, } else { - for (int l = 0; l < sampleCount[i][j]; l++) + for (unsigned int l = 0; l < sampleCount[i][j]; l++) { if (channelTypes[k] == 0) ((unsigned int*)data[k][i][j])[l] = (i * width + j) % 2049; @@ -299,7 +303,7 @@ readFile (int channelCount, bool bulkRead, const std::string & fn) for (int i = 0; i < channelCount; i++) { - PixelType type; + PixelType type = NUM_PIXELTYPES; if (channelTypes[i] == 0) type = IMF::UINT; if (channelTypes[i] == 1) @@ -311,7 +315,7 @@ readFile (int channelCount, bool bulkRead, const std::string & fn) ss << i; string str = ss.str(); - int sampleSize; + int sampleSize = 0; if (channelTypes[i] == 0) sampleSize = sizeof (unsigned int); if (channelTypes[i] == 1) sampleSize = sizeof (half); if (channelTypes[i] == 2) sampleSize = sizeof (float); @@ -337,9 +341,6 @@ readFile (int channelCount, bool bulkRead, const std::string & fn) for (int i = 0; i < dataWindow.max.y - dataWindow.min.y + 1; i++) { - int y = i + dataWindow.min.y; - - for (int j = 0; j < width; j++) { assert(localSampleCount[i][j] == sampleCount[i][j]); @@ -435,4 +436,3 @@ void testDeepScanLineHuge (const std::string & tempDir) assert (false); } } - diff --git a/OpenEXR/IlmImfTest/testDeepScanLineMultipleRead.cpp b/OpenEXR/IlmImfTest/testDeepScanLineMultipleRead.cpp index e5f0b03f5e..1a33f4e1b1 100644 --- a/OpenEXR/IlmImfTest/testDeepScanLineMultipleRead.cpp +++ b/OpenEXR/IlmImfTest/testDeepScanLineMultipleRead.cpp @@ -31,6 +31,10 @@ // /////////////////////////////////////////////////////////////////////////// +#ifdef NDEBUG +# undef NDEBUG +#endif + #include "testCompositeDeepScanLine.h" #include @@ -51,8 +55,6 @@ namespace{ -const char source_filename[] = IMF_TMP_DIR "imf_test_multiple_read.exr"; - using std::cout; using std::endl; using std::flush; @@ -161,14 +163,14 @@ static void read_file(const char * filename) for(int i=0;i(row)) { cout << i << ", " << row << " error, sample counts hould be " << row << ", is " << samplecounts[i] << endl << flush; } - assert (samplecounts[i]== row); + assert (samplecounts[i]== static_cast(row)); total_samples+=samplecounts[i]; } diff --git a/OpenEXR/IlmImfTest/testDeepTiledBasic.cpp b/OpenEXR/IlmImfTest/testDeepTiledBasic.cpp index 081005e85c..bcded5792e 100644 --- a/OpenEXR/IlmImfTest/testDeepTiledBasic.cpp +++ b/OpenEXR/IlmImfTest/testDeepTiledBasic.cpp @@ -32,6 +32,10 @@ // /////////////////////////////////////////////////////////////////////////// +#ifdef NDEBUG +# undef NDEBUG +#endif + #include "testDeepTiledBasic.h" #include @@ -152,7 +156,7 @@ void generateRandomFile (int channelCount, for (int i = 0; i < channelCount; i++) { - PixelType type; + PixelType type = NUM_PIXELTYPES; if (channelTypes[i] == 0) type = IMF::UINT; if (channelTypes[i] == 1) @@ -164,7 +168,7 @@ void generateRandomFile (int channelCount, ss << i; string str = ss.str(); - int sampleSize; + int sampleSize = 0; if (channelTypes[i] == 0) sampleSize = sizeof (unsigned int); if (channelTypes[i] == 1) sampleSize = sizeof (half); if (channelTypes[i] == 2) sampleSize = sizeof (float); @@ -228,7 +232,7 @@ void generateRandomFile (int channelCount, data[k][dwy][dwx] = new half[sampleCount[dwy][dwx]]; if (channelTypes[k] == 2) data[k][dwy][dwx] = new float[sampleCount[dwy][dwx]]; - for (int l = 0; l < sampleCount[dwy][dwx]; l++) + for (unsigned int l = 0; l < sampleCount[dwy][dwx]; l++) { if (channelTypes[k] == 0) ((unsigned int*)data[k][dwy][dwx])[l] = (dwy * width + dwx) % 2049; @@ -272,7 +276,7 @@ void generateRandomFile (int channelCount, data[k][dwy][dwx] = new half[sampleCount[dwy][dwx]]; if (channelTypes[k] == 2) data[k][dwy][dwx] = new float[sampleCount[dwy][dwx]]; - for (int l = 0; l < sampleCount[dwy][dwx]; l++) + for (unsigned int l = 0; l < sampleCount[dwy][dwx]; l++) { if (channelTypes[k] == 0) ((unsigned int*)data[k][dwy][dwx])[l] = (dwy * width + dwx) % 2049; @@ -315,7 +319,7 @@ void generateRandomFile (int channelCount, data[k][ty][tx] = new half[sampleCount[ty][tx]]; if (channelTypes[k] == 2) data[k][ty][tx] = new float[sampleCount[ty][tx]]; - for (int l = 0; l < sampleCount[ty][tx]; l++) + for (unsigned int l = 0; l < sampleCount[ty][tx]; l++) { if (channelTypes[k] == 0) ((unsigned int*)data[k][ty][tx])[l] = @@ -377,11 +381,11 @@ void checkValue (void* sampleRawData, if (channelType == 0) { unsigned int* value = (unsigned int*)(sampleRawData); - if (value[l] != (dwy * width + dwx) % 2049) + if (value[l] != static_cast((dwy * width + dwx) % 2049)) cout << dwx << ", " << dwy << " error, should be " << (dwy * width + dwx) % 2049 << ", is " << value[l] << endl << flush; - assert (value[l] == (dwy * width + dwx) % 2049); + assert (value[l] == static_cast((dwy * width + dwx) % 2049)); } if (channelType == 1) { @@ -452,7 +456,7 @@ void readFile (int channelCount, for (int i = 0; i < channelCount; i++) { - PixelType type; + PixelType type = NUM_PIXELTYPES; if (channelTypes[i] == 0) type = IMF::UINT; if (channelTypes[i] == 1) @@ -464,7 +468,7 @@ void readFile (int channelCount, ss << i; string str = ss.str(); - int sampleSize; + int sampleSize = 0; if (channelTypes[i] == 0) sampleSize = sizeof (unsigned int); if (channelTypes[i] == 1) sampleSize = sizeof (half); if (channelTypes[i] == 2) sampleSize = sizeof (float); @@ -520,7 +524,7 @@ void readFile (int channelCount, int dwx = x - dataWindowL.min.x; assert(localSampleCount[dwy][dwx] == sampleCountWhole[ly][lx][dwy][dwx]); - for (int k = 0; k < channelTypes.size(); k++) + for (size_t k = 0; k < channelTypes.size(); k++) { if (channelTypes[k] == 0) data[k][dwy][dwx] = new unsigned int[localSampleCount[dwy][dwx]]; @@ -557,7 +561,7 @@ void readFile (int channelCount, int dwx = x - dataWindowL.min.x; assert(localSampleCount[dwy][dwx] == sampleCountWhole[ly][lx][dwy][dwx]); - for (int k = 0; k < channelTypes.size(); k++) + for (size_t k = 0; k < channelTypes.size(); k++) { if (channelTypes[k] == 0) data[k][dwy][dwx] = new unsigned int[localSampleCount[dwy][dwx]]; @@ -594,7 +598,7 @@ void readFile (int channelCount, int tx = x - box.min.x; assert(localSampleCount[ty][tx] == sampleCountWhole[ly][lx][dwy][dwx]); - for (int k = 0; k < channelTypes.size(); k++) + for (size_t k = 0; k < channelTypes.size(); k++) { if (channelTypes[k] == 0) data[k][ty][tx] = new unsigned int[localSampleCount[ty][tx]]; @@ -615,7 +619,7 @@ void readFile (int channelCount, int ty = y - box.min.y; int tx = x - box.min.x; - for (int k = 0; k < channelTypes.size(); k++) + for (size_t k = 0; k < channelTypes.size(); k++) { checkValue(data[k][ty][tx], localSampleCount[ty][tx], @@ -640,16 +644,16 @@ void readFile (int channelCount, for (int j = 0; j < file.levelWidth(lx); j++) for (int k = 0; k < channelCount; k++) { - for (int l = 0; l < localSampleCount[i][j]; l++) + for (unsigned int l = 0; l < localSampleCount[i][j]; l++) { if (channelTypes[k] == 0) { unsigned int* value = (unsigned int*)(data[k][i][j]); - if (value[l] != (i * width + j) % 2049) + if (value[l] != static_cast((i * width + j) % 2049)) cout << j << ", " << i << " error, should be " << (i * width + j) % 2049 << ", is " << value[l] << endl << flush; - assert (value[l] == (i * width + j) % 2049); + assert (value[l] == static_cast((i * width + j) % 2049)); } if (channelTypes[k] == 1) { diff --git a/OpenEXR/IlmImfTest/testDwaCompressorSimd.cpp b/OpenEXR/IlmImfTest/testDwaCompressorSimd.cpp index e144aa81eb..0691ada6b1 100644 --- a/OpenEXR/IlmImfTest/testDwaCompressorSimd.cpp +++ b/OpenEXR/IlmImfTest/testDwaCompressorSimd.cpp @@ -31,6 +31,10 @@ // /////////////////////////////////////////////////////////////////////////// +#ifdef NDEBUG +# undef NDEBUG +#endif + #include #include #include diff --git a/OpenEXR/IlmImfTest/testExistingStreams.cpp b/OpenEXR/IlmImfTest/testExistingStreams.cpp index 69658c377c..67fc7422ac 100644 --- a/OpenEXR/IlmImfTest/testExistingStreams.cpp +++ b/OpenEXR/IlmImfTest/testExistingStreams.cpp @@ -32,6 +32,9 @@ // /////////////////////////////////////////////////////////////////////////// +#ifdef NDEBUG +# undef NDEBUG +#endif #include #include diff --git a/OpenEXR/IlmImfTest/testFutureProofing.cpp b/OpenEXR/IlmImfTest/testFutureProofing.cpp index 05664b3799..9e2f4d3c42 100644 --- a/OpenEXR/IlmImfTest/testFutureProofing.cpp +++ b/OpenEXR/IlmImfTest/testFutureProofing.cpp @@ -33,7 +33,11 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // /////////////////////////////////////////////////////////////////////////// - + +#ifdef NDEBUG +# undef NDEBUG +#endif + #include #include #include @@ -108,7 +112,7 @@ fillPixels (Array2D& sampleCount, Array2D &ph, int width, int for (int x = 0; x < width; ++x) { ph[y][x] = new T[sampleCount[y][x]]; - for (int i = 0; i < sampleCount[y][x]; i++) + for (unsigned int i = 0; i < sampleCount[y][x]; i++) { // // We do this because half cannot store number bigger than 2048 exactly. @@ -190,7 +194,7 @@ checkPixels (Array2D &ph, int lx, int rx, int ly, int ry, int width) { for (int x = lx; x <= rx; ++x) { - if (ph[y][x] != (y * width + x) % 2049) + if (ph[y][x] != static_cast(((y * width + x) % 2049))) { cout << "value at " << x << ", " << y << ": " << ph[y][x] << ", should be " << (y * width + x) % 2049 << endl << flush; @@ -219,9 +223,9 @@ checkPixels (Array2D& sampleCount, { for (int x = lx; x <= rx; ++x) { - for (int i = 0; i < sampleCount[y][x]; i++) + for (unsigned int i = 0; i < sampleCount[y][x]; i++) { - if (ph[y][x][i] != (y * width + x) % 2049) + if (ph[y][x][i] != static_cast(((y * width + x) % 2049))) { cout << "value at " << x << ", " << y << ", sample " << i << ": " << ph[y][x][i] << ", should be " << (y * width + x) % 2049 << endl << flush; @@ -251,7 +255,7 @@ checkSampleCount (Array2D& sampleCount, { for (int j = x1; j <= x2; j++) { - if (sampleCount[i][j] != ((i * width) + j) % 10 + 1) + if (sampleCount[i][j] != static_cast(((i * width) + j) % 10 + 1)) { cout << "sample count at " << j << ", " << i << ": " << sampleCount[i][j] << ", should be " << (i * width + j) % 10 + 1 << endl << flush; @@ -262,11 +266,13 @@ checkSampleCount (Array2D& sampleCount, return true; } +#if 0 bool checkSampleCount (Array2D& sampleCount, int width, int height) { return checkSampleCount(sampleCount, 0, width - 1, 0, height - 1, width); } +#endif void generateRandomHeaders (int partCount, vector
& headers) @@ -332,7 +338,7 @@ generateRandomHeaders (int partCount, vector
& headers) tileY = rand() % height + 1; levelMode = rand() % 3; levelModes[i] = levelMode; - LevelMode lm; + LevelMode lm = NUM_LEVELMODES; switch (levelMode) { case 0: @@ -355,7 +361,7 @@ generateRandomHeaders (int partCount, vector
& headers) // can't write random scanlines order = rand() % (NUM_LINEORDERS-1); } - LineOrder l; + LineOrder l = NUM_LINEORDERS; switch(order) { case 0 : @@ -739,7 +745,7 @@ readWholeFiles (int modification) Array2D sampleCount; MultiPartInputFile file(filename.c_str()); - for (size_t i = 0; i < file.parts(); i++) + for (int i = 0; i < file.parts(); i++) { const Header& header = file.header(i); assert (header.displayWindow() == headers[i].displayWindow()); @@ -767,12 +773,12 @@ readWholeFiles (int modification) // Shuffle part numbers. // vector shuffledPartNumber; - for (int i = modification>0 ? 1 : 0; i < headers.size(); i++) + for (int i = modification>0 ? 1 : 0; i < static_cast(headers.size()); i++) shuffledPartNumber.push_back(i); - for (int i = 0; i < shuffledPartNumber.size(); i++) + for (size_t i = 0; i < shuffledPartNumber.size(); i++) { - int a = rand() % shuffledPartNumber.size(); - int b = rand() % shuffledPartNumber.size(); + size_t a = rand() % shuffledPartNumber.size(); + size_t b = rand() % shuffledPartNumber.size(); swap (shuffledPartNumber[a], shuffledPartNumber[b]); } @@ -782,11 +788,10 @@ readWholeFiles (int modification) // // Start reading whole files. // - int i; int partNumber; try { - for (i = 0; i < shuffledPartNumber.size(); i++) + for (size_t i = 0; i < shuffledPartNumber.size(); i++) { partNumber = shuffledPartNumber[i]; switch (partTypes[partNumber]) @@ -1206,7 +1211,7 @@ modifyType (bool modify_version) } // skip over each header - for(int i=0;i #include "ImathRandom.h" diff --git a/OpenEXR/IlmImfTest/testInputPart.cpp b/OpenEXR/IlmImfTest/testInputPart.cpp index 2369a5554d..b53b158744 100644 --- a/OpenEXR/IlmImfTest/testInputPart.cpp +++ b/OpenEXR/IlmImfTest/testInputPart.cpp @@ -33,7 +33,11 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // /////////////////////////////////////////////////////////////////////////// - + +#ifdef NDEBUG +# undef NDEBUG +#endif + #include #include #include @@ -104,6 +108,7 @@ void fillPixels (Array2D& sampleCount, Array2D &ph, int width, } } +#if 0 void allocatePixels(int type, Array2D& sampleCount, Array2D& uintData, Array2D& floatData, Array2D& halfData, int x1, int x2, int y1, int y2) @@ -147,13 +152,14 @@ void releasePixels(int type, Array2D& uintData, Array2D& { releasePixels(type, uintData, floatData, halfData, 0, width - 1, 0, height - 1); } +#endif template bool checkPixels (Array2D &ph, int lx, int rx, int ly, int ry, int width) { for (int y = ly; y <= ry; ++y) for (int x = lx; x <= rx; ++x) - if (ph[y][x] != (y * width + x) % 2049) + if (ph[y][x] != static_cast(((y * width + x) % 2049))) { cout << "value at " << x << ", " << y << ": " << ph[y][x] << ", should be " << (y * width + x) % 2049 << endl << flush; @@ -194,12 +200,13 @@ bool checkPixels (Array2D& sampleCount, Array2D &ph, int width return checkPixels (sampleCount, ph, 0, width - 1, 0, height - 1, width); } +#if 0 bool checkSampleCount(Array2D& sampleCount, int x1, int x2, int y1, int y2, int width) { for (int i = y1; i <= y2; i++) for (int j = x1; j <= x2; j++) { - if (sampleCount[i][j] != ((i * width) + j) % 10 + 1) + if (sampleCount[i][j] != static_cast(((i * width) + j) % 10 + 1)) { cout << "sample count at " << j << ", " << i << ": " << sampleCount[i][j] << ", should be " << (i * width + j) % 10 + 1 << endl << flush; @@ -213,6 +220,7 @@ bool checkSampleCount(Array2D& sampleCount, int width, int height) { return checkSampleCount(sampleCount, 0, width - 1, 0, height - 1, width); } +#endif void generateRandomHeaders(int partCount, vector
& headers) { @@ -271,7 +279,7 @@ void generateRandomHeaders(int partCount, vector
& headers) tileY = rand() % height + 1; levelMode = rand() % 3; levelModes[i] = levelMode; - LevelMode lm; + LevelMode lm = NUM_LEVELMODES; switch (levelMode) { case 0: @@ -294,7 +302,7 @@ void generateRandomHeaders(int partCount, vector
& headers) // can't write random scanlines order = rand() % (NUM_LINEORDERS-1); } - LineOrder l; + LineOrder l = NUM_LINEORDERS; switch(order) { case 0 : @@ -507,7 +515,7 @@ readWholeFiles (const std::string & fn) Array2D sampleCount; MultiPartInputFile file(fn.c_str()); - for (size_t i = 0; i < file.parts(); i++) + for (int i = 0; i < file.parts(); i++) { const Header& header = file.header(i); assert (header.displayWindow() == headers[i].displayWindow()); @@ -528,12 +536,13 @@ readWholeFiles (const std::string & fn) // Shuffle part numbers. // vector shuffledPartNumber; - for (int i = 0; i < headers.size(); i++) + int nHeaders = static_cast(headers.size()); + for (int i = 0; i < nHeaders; i++) shuffledPartNumber.push_back(i); - for (int i = 0; i < headers.size(); i++) + for (int i = 0; i < nHeaders; i++) { - int a = rand() % headers.size(); - int b = rand() % headers.size(); + int a = rand() % nHeaders; + int b = rand() % nHeaders; swap (shuffledPartNumber[a], shuffledPartNumber[b]); } @@ -544,7 +553,7 @@ readWholeFiles (const std::string & fn) int partNumber; try { - for (i = 0; i < headers.size(); i++) + for (i = 0; i < nHeaders; i++) { partNumber = shuffledPartNumber[i]; FrameBuffer frameBuffer; @@ -590,7 +599,7 @@ readFirstPart (const std::string & fn) cout << "Reading first part " << flush; int pixelType = pixelTypes[0]; - int levelMode = levelModes[0]; + //int levelMode = levelModes[0]; int l1, l2; l1 = rand() % height; @@ -639,9 +648,9 @@ readPartialFiles (int randomReadCount, const std::string & fn) for (int i = 0; i < randomReadCount; i++) { int partNumber = rand() % file.parts(); - int partType = partTypes[partNumber]; + //int partType = partTypes[partNumber]; int pixelType = pixelTypes[partNumber]; - int levelMode = levelModes[partNumber]; + //int levelMode = levelModes[partNumber]; int l1, l2; l1 = rand() % height; diff --git a/OpenEXR/IlmImfTest/testIsComplete.cpp b/OpenEXR/IlmImfTest/testIsComplete.cpp index fe74d5ff29..681446878c 100644 --- a/OpenEXR/IlmImfTest/testIsComplete.cpp +++ b/OpenEXR/IlmImfTest/testIsComplete.cpp @@ -32,6 +32,9 @@ // /////////////////////////////////////////////////////////////////////////// +#ifdef NDEBUG +# undef NDEBUG +#endif #include #include diff --git a/OpenEXR/IlmImfTest/testLineOrder.cpp b/OpenEXR/IlmImfTest/testLineOrder.cpp index 4ec6424022..1f65c207cc 100644 --- a/OpenEXR/IlmImfTest/testLineOrder.cpp +++ b/OpenEXR/IlmImfTest/testLineOrder.cpp @@ -32,6 +32,9 @@ // /////////////////////////////////////////////////////////////////////////// +#ifdef NDEBUG +# undef NDEBUG +#endif #include #include diff --git a/OpenEXR/IlmImfTest/testLut.cpp b/OpenEXR/IlmImfTest/testLut.cpp index 26455fcae7..d3bbfe93c4 100644 --- a/OpenEXR/IlmImfTest/testLut.cpp +++ b/OpenEXR/IlmImfTest/testLut.cpp @@ -32,7 +32,9 @@ // /////////////////////////////////////////////////////////////////////////// - +#ifdef NDEBUG +# undef NDEBUG +#endif #include #include diff --git a/OpenEXR/IlmImfTest/testMagic.cpp b/OpenEXR/IlmImfTest/testMagic.cpp index afe87e1356..1d95c091bd 100644 --- a/OpenEXR/IlmImfTest/testMagic.cpp +++ b/OpenEXR/IlmImfTest/testMagic.cpp @@ -32,6 +32,10 @@ // /////////////////////////////////////////////////////////////////////////// +#ifdef NDEBUG +# undef NDEBUG +#endif + #include #include #include diff --git a/OpenEXR/IlmImfTest/testMalformedImages.cpp b/OpenEXR/IlmImfTest/testMalformedImages.cpp index 533ff2cff4..2fc1b7d46a 100644 --- a/OpenEXR/IlmImfTest/testMalformedImages.cpp +++ b/OpenEXR/IlmImfTest/testMalformedImages.cpp @@ -32,6 +32,10 @@ // /////////////////////////////////////////////////////////////////////////// +#ifdef NDEBUG +# undef NDEBUG +#endif + #include #include #include @@ -56,7 +60,6 @@ readImage (const char inFileName[]) { Array2D p; Header h; - RgbaChannels ch; Box2i dw; int width; int height; @@ -67,7 +70,6 @@ readImage (const char inFileName[]) AcesInputFile in (inFileName); h = in.header(); - ch = in.channels(); dw = h.dataWindow(); width = dw.max.x - dw.min.x + 1; @@ -88,7 +90,7 @@ readBadBoundsImage (const char fileName[]) cout << "version " << in.version() << " " << flush; - const Box2i &dw = in.dataWindow(); + //const Box2i &dw = in.dataWindow(); } } // namespace diff --git a/OpenEXR/IlmImfTest/testMultiPartApi.cpp b/OpenEXR/IlmImfTest/testMultiPartApi.cpp index 2fd7b47ee9..58db06488a 100644 --- a/OpenEXR/IlmImfTest/testMultiPartApi.cpp +++ b/OpenEXR/IlmImfTest/testMultiPartApi.cpp @@ -32,6 +32,10 @@ // /////////////////////////////////////////////////////////////////////////// +#ifdef NDEBUG +# undef NDEBUG +#endif + #include #include #include @@ -109,7 +113,7 @@ bool checkPixels (Array2D &ph, int lx, int rx, int ly, int ry, int width) { for (int y = ly; y <= ry; ++y) for (int x = lx; x <= rx; ++x) - if (ph[y][x] != (y * width + x) % 2049) + if (ph[y][x] != static_cast(((y * width + x) % 2049))) { cout << "value at " << x << ", " << y << ": " << ph[y][x] << ", should be " << (y * width + x) % 2049 << endl << flush; @@ -164,14 +168,14 @@ void generateRandomHeaders(int partCount, vector
& headers, vector& int tileX; int tileY; - int levelMode; + int levelMode = 0; if (partType == 1) { tileX = rand() % width + 1; tileY = rand() % height + 1; levelMode = rand() % 3; levelModes[i] = levelMode; - LevelMode lm; + LevelMode lm = NUM_LEVELMODES; switch (levelMode) { case 0: @@ -440,8 +444,7 @@ generateRandomFile (int partCount, const std::string & fn) { int partNumber = taskList[i].partNumber; int partType = partTypes[partNumber]; - int pixelType = pixelTypes[partNumber]; - int levelMode = levelModes[partNumber]; + if (partType == 0) { OutputPart* part = (OutputPart*) parts[partNumber]; @@ -472,7 +475,7 @@ readWholeFiles (const std::string & fn) Array2D hData; MultiPartInputFile file(fn.c_str()); - for (size_t i = 0; i < file.parts(); i++) + for (size_t i = 0; i < static_cast(file.parts()); i++) { const Header& header = file.header(i); assert (header.displayWindow() == headers[i].displayWindow()); @@ -509,12 +512,13 @@ readWholeFiles (const std::string & fn) // Shuffle part numbers. // vector shuffledPartNumber; - for (int i = 0; i < headers.size(); i++) + int nHeaders = static_cast(headers.size()); + for (int i = 0; i < nHeaders; i++) shuffledPartNumber.push_back(i); - for (int i = 0; i < headers.size(); i++) + for (int i = 0; i < nHeaders; i++) { - int a = rand() % headers.size(); - int b = rand() % headers.size(); + int a = rand() % nHeaders; + int b = rand() % nHeaders; swap (shuffledPartNumber[a], shuffledPartNumber[b]); } @@ -525,7 +529,7 @@ readWholeFiles (const std::string & fn) int partNumber; try { - for (i = 0; i < headers.size(); i++) + for (i = 0; i < nHeaders; i++) { partNumber = shuffledPartNumber[i]; if (partTypes[partNumber] == 0) diff --git a/OpenEXR/IlmImfTest/testMultiPartFileMixingBasic.cpp b/OpenEXR/IlmImfTest/testMultiPartFileMixingBasic.cpp index da75a1f42e..31a8a7139b 100644 --- a/OpenEXR/IlmImfTest/testMultiPartFileMixingBasic.cpp +++ b/OpenEXR/IlmImfTest/testMultiPartFileMixingBasic.cpp @@ -33,7 +33,11 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // /////////////////////////////////////////////////////////////////////////// - + +#ifdef NDEBUG +# undef NDEBUG +#endif + #include #include #include @@ -102,7 +106,7 @@ void fillPixels (Array2D& sampleCount, Array2D &ph, int width, for (int x = 0; x < width; ++x) { ph[y][x] = new T[sampleCount[y][x]]; - for (int i = 0; i < sampleCount[y][x]; i++) + for (unsigned int i = 0; i < sampleCount[y][x]; i++) { // // We do this because half cannot store number bigger than 2048 exactly. @@ -161,7 +165,7 @@ bool checkPixels (Array2D &ph, int lx, int rx, int ly, int ry, int width) { for (int y = ly; y <= ry; ++y) for (int x = lx; x <= rx; ++x) - if (ph[y][x] != (y * width + x) % 2049) + if (ph[y][x] != static_cast(((y * width + x) % 2049))) { cout << "value at " << x << ", " << y << ": " << ph[y][x] << ", should be " << (y * width + x) % 2049 << endl << flush; @@ -183,9 +187,9 @@ bool checkPixels (Array2D& sampleCount, Array2D &ph, for (int y = ly; y <= ry; ++y) for (int x = lx; x <= rx; ++x) { - for (int i = 0; i < sampleCount[y][x]; i++) + for (unsigned int i = 0; i < sampleCount[y][x]; i++) { - if (ph[y][x][i] != (y * width + x) % 2049) + if (ph[y][x][i] != static_cast(((y * width + x) % 2049))) { cout << "value at " << x << ", " << y << ", sample " << i << ": " << ph[y][x][i] << ", should be " << (y * width + x) % 2049 << endl << flush; @@ -207,7 +211,7 @@ bool checkSampleCount(Array2D& sampleCount, int x1, int x2, int y1 for (int i = y1; i <= y2; i++) for (int j = x1; j <= x2; j++) { - if (sampleCount[i][j] != ((i * width) + j) % 10 + 1) + if (sampleCount[i][j] != static_cast(((i * width) + j) % 10 + 1)) { cout << "sample count at " << j << ", " << i << ": " << sampleCount[i][j] << ", should be " << (i * width + j) % 10 + 1 << endl << flush; @@ -217,10 +221,12 @@ bool checkSampleCount(Array2D& sampleCount, int x1, int x2, int y1 return true; } +#if 0 bool checkSampleCount(Array2D& sampleCount, int width, int height) { return checkSampleCount(sampleCount, 0, width - 1, 0, height - 1, width); } +#endif void generateRandomHeaders(int partCount, vector
& headers) { @@ -285,7 +291,7 @@ void generateRandomHeaders(int partCount, vector
& headers) tileY = rand() % height + 1; levelMode = rand() % 3; levelModes[i] = levelMode; - LevelMode lm; + LevelMode lm = NUM_LEVELMODES; switch (levelMode) { case 0: @@ -308,7 +314,7 @@ void generateRandomHeaders(int partCount, vector
& headers) // can't write random scanlines order = rand() % (NUM_LINEORDERS-1); } - LineOrder l; + LineOrder l = NUM_LINEORDERS; switch(order) { case 0 : @@ -673,7 +679,7 @@ readWholeFiles (const std::string & fn) Array2D sampleCount; MultiPartInputFile file (fn.c_str()); - for (size_t i = 0; i < file.parts(); i++) + for (int i = 0; i < file.parts(); i++) { const Header& header = file.header(i); assert (header.displayWindow() == headers[i].displayWindow()); @@ -694,12 +700,13 @@ readWholeFiles (const std::string & fn) // Shuffle part numbers. // vector shuffledPartNumber; - for (int i = 0; i < headers.size(); i++) + int nHeaders = static_cast (headers.size()); + for (int i = 0; i < nHeaders; i++) shuffledPartNumber.push_back(i); - for (int i = 0; i < headers.size(); i++) + for (int i = 0; i < nHeaders; i++) { - int a = rand() % headers.size(); - int b = rand() % headers.size(); + int a = rand() % nHeaders; + int b = rand() % nHeaders; swap (shuffledPartNumber[a], shuffledPartNumber[b]); } @@ -710,7 +717,7 @@ readWholeFiles (const std::string & fn) int partNumber; try { - for (i = 0; i < headers.size(); i++) + for (i = 0; i < nHeaders; i++) { partNumber = shuffledPartNumber[i]; switch (partTypes[partNumber]) @@ -1357,7 +1364,7 @@ killOffsetTables (const std::string & fn) } // skip over each header - for(int i=0;i @@ -122,7 +126,7 @@ generateRandomHeaders (int partCount, vector
& headers) tileX = rand() % width + 1; tileY = rand() % height + 1; levelMode = rand() % 3; - LevelMode lm; + LevelMode lm = NUM_LEVELMODES; switch (levelMode) { case 0: @@ -186,7 +190,6 @@ testPixelAspectRatio (const vector
& hs, const std::string & fn) { vector
headers(hs); - IMATH_NAMESPACE::Box2i newDisplayWindow = headers[0].displayWindow(); Header newHeader (headers[0].displayWindow().size().x+1, headers[0].displayWindow().size().y+1, headers[0].pixelAspectRatio() + 1.f); @@ -225,7 +228,7 @@ testTimeCode (const vector
& hs, const std::string & fn) // Test against a vector of headers that has chromaticities attribute // but of differing value // - for (int i=0; i & hs, const std::string & fn) // Test against a vector of headers that has chromaticities attribute // but of differing value // - for (int i=0; i ia; - for (int i=0; i #include #include @@ -96,7 +100,7 @@ bool checkPixels (Array2D &ph, int lx, int rx, int ly, int ry, int width) { for (int y = ly; y <= ry; ++y) for (int x = lx; x <= rx; ++x) - if (ph[y][x] != (y * width + x) % 2049) + if (ph[y][x] != static_cast(((y * width + x) % 2049))) { cout << "value at " << x << ", " << y << ": " << ph[y][x] << ", should be " << (y * width + x) % 2049 << endl << flush; @@ -211,12 +215,10 @@ class WritingTask: public Task void execute() { - for (int i = 0; i < data.size(); i++) + for (size_t i = 0; i < data.size(); i++) { int partNumber = data[i]->partNumber; int partType = partTypes[partNumber]; - int pixelType = pixelTypes[partNumber]; - int levelMode = levelModes[partNumber]; if (partType == 0) { @@ -405,14 +407,14 @@ void generateRandomHeaders(int partCount, vector
& headers, vector hData; MultiPartInputFile file(fn.c_str()); - for (size_t i = 0; i < file.parts(); i++) + for (size_t i = 0; i < static_cast(file.parts()); i++) { const Header& header = file.header(i); assert (header.displayWindow() == headers[i].displayWindow()); @@ -674,12 +676,13 @@ readWholeFiles (const std::string & fn) // Shuffle part numbers. // vector shuffledPartNumber; - for (int i = 0; i < headers.size(); i++) + int nHeaders = static_cast(headers.size()); + for (int i = 0; i < nHeaders; i++) shuffledPartNumber.push_back(i); - for (int i = 0; i < headers.size(); i++) + for (int i = 0; i < nHeaders; i++) { - int a = rand() % headers.size(); - int b = rand() % headers.size(); + int a = rand() % nHeaders; + int b = rand() % nHeaders; swap (shuffledPartNumber[a], shuffledPartNumber[b]); } @@ -690,7 +693,7 @@ readWholeFiles (const std::string & fn) int partNumber; try { - for (i = 0; i < headers.size(); i++) + for (i = 0; i < nHeaders; i++) { partNumber = shuffledPartNumber[i]; if (partTypes[partNumber] == 0) diff --git a/OpenEXR/IlmImfTest/testMultiScanlinePartThreading.cpp b/OpenEXR/IlmImfTest/testMultiScanlinePartThreading.cpp index 85058c4ce0..cd05a818bb 100644 --- a/OpenEXR/IlmImfTest/testMultiScanlinePartThreading.cpp +++ b/OpenEXR/IlmImfTest/testMultiScanlinePartThreading.cpp @@ -32,6 +32,10 @@ // /////////////////////////////////////////////////////////////////////////// +#ifdef NDEBUG +# undef NDEBUG +#endif + #include #include #include @@ -91,7 +95,7 @@ bool checkPixels (Array2D &ph, int lx, int rx, int ly, int ry, int width) { for (int y = ly; y <= ry; ++y) for (int x = lx; x <= rx; ++x) - if (ph[y][x] != (y * width + x) % 2049) + if (ph[y][x] != static_cast(((y * width + x) % 2049))) { cout << "value at " << x << ", " << y << ": " << ph[y][x] << ", should be " << (y * width + x) % 2049 << endl << flush; diff --git a/OpenEXR/IlmImfTest/testMultiTiledPartThreading.cpp b/OpenEXR/IlmImfTest/testMultiTiledPartThreading.cpp index d85af6b264..2439156d0a 100644 --- a/OpenEXR/IlmImfTest/testMultiTiledPartThreading.cpp +++ b/OpenEXR/IlmImfTest/testMultiTiledPartThreading.cpp @@ -32,6 +32,10 @@ // /////////////////////////////////////////////////////////////////////////// +#ifdef NDEBUG +# undef NDEBUG +#endif + #include #include #include @@ -96,7 +100,7 @@ bool checkPixels (Array2D &ph, int lx, int rx, int ly, int ry, int width) { for (int y = ly; y <= ry; ++y) for (int x = lx; x <= rx; ++x) - if (ph[y][x] != (y * width + x) % 2049) + if (ph[y][x] != static_cast(((y * width + x) % 2049))) { cout << "value at " << x << ", " << y << ": " << ph[y][x] << ", should be " << (y * width + x) % 2049 << endl << flush; @@ -265,7 +269,7 @@ generateFiles (const std::string & fn) int tileX = tileSize; int tileY = tileSize; - LevelMode lm; + LevelMode lm = NUM_LEVELMODES; switch (levelMode) { case 0: diff --git a/OpenEXR/IlmImfTest/testMultiView.cpp b/OpenEXR/IlmImfTest/testMultiView.cpp index 34ef9677e4..af3f0ad9b8 100644 --- a/OpenEXR/IlmImfTest/testMultiView.cpp +++ b/OpenEXR/IlmImfTest/testMultiView.cpp @@ -32,7 +32,9 @@ // /////////////////////////////////////////////////////////////////////////// - +#ifdef NDEBUG +# undef NDEBUG +#endif #include diff --git a/OpenEXR/IlmImfTest/testNativeFormat.cpp b/OpenEXR/IlmImfTest/testNativeFormat.cpp index 7555fc1723..5b027bc011 100644 --- a/OpenEXR/IlmImfTest/testNativeFormat.cpp +++ b/OpenEXR/IlmImfTest/testNativeFormat.cpp @@ -32,6 +32,9 @@ // /////////////////////////////////////////////////////////////////////////// +#ifdef NDEBUG +# undef NDEBUG +#endif #include #include diff --git a/OpenEXR/IlmImfTest/testOptimized.cpp b/OpenEXR/IlmImfTest/testOptimized.cpp index 427090c77b..21b019d9dc 100644 --- a/OpenEXR/IlmImfTest/testOptimized.cpp +++ b/OpenEXR/IlmImfTest/testOptimized.cpp @@ -32,6 +32,9 @@ // /////////////////////////////////////////////////////////////////////////// +#ifdef NDEBUG +# undef NDEBUG +#endif #include #include @@ -321,7 +324,6 @@ readPixels (const char pFilename[], int pNbChannels, Array2D& pPixels) IMATH::Box2i lDataWindow = lFile.header().dataWindow(); int lWidth = lDataWindow.max.x - lDataWindow.min.x + 1; - int lHeight = lDataWindow.max.y - lDataWindow.min.y + 1; FrameBuffer lInputFrameBuffer; @@ -380,7 +382,6 @@ readPixels (const char pFilename[], IMATH::Box2i lDataWindow = lFile.header().dataWindow(); int lWidth = lDataWindow.max.x - lDataWindow.min.x + 1; - int lHeight = lDataWindow.max.y - lDataWindow.min.y + 1; FrameBuffer lInputFrameBuffer; diff --git a/OpenEXR/IlmImfTest/testOptimizedInterleavePatterns.cpp b/OpenEXR/IlmImfTest/testOptimizedInterleavePatterns.cpp index f6b37b8b54..1ed74d2e7a 100644 --- a/OpenEXR/IlmImfTest/testOptimizedInterleavePatterns.cpp +++ b/OpenEXR/IlmImfTest/testOptimizedInterleavePatterns.cpp @@ -31,6 +31,10 @@ // /////////////////////////////////////////////////////////////////////////// +#ifdef NDEBUG +# undef NDEBUG +#endif + #include "ImfInputFile.h" #include #include @@ -621,4 +625,3 @@ testOptimizedInterleavePatterns (const std::string & tempDir) cout << "ok\n" << endl; } - diff --git a/OpenEXR/IlmImfTest/testPartHelper.cpp b/OpenEXR/IlmImfTest/testPartHelper.cpp index f5f2e59212..5788f8de84 100644 --- a/OpenEXR/IlmImfTest/testPartHelper.cpp +++ b/OpenEXR/IlmImfTest/testPartHelper.cpp @@ -31,6 +31,10 @@ // /////////////////////////////////////////////////////////////////////////// +#ifdef NDEBUG +# undef NDEBUG +#endif + #include "testPartHelper.h" #include diff --git a/OpenEXR/IlmImfTest/testPreviewImage.cpp b/OpenEXR/IlmImfTest/testPreviewImage.cpp index 16c057362e..ad4fae9dc0 100644 --- a/OpenEXR/IlmImfTest/testPreviewImage.cpp +++ b/OpenEXR/IlmImfTest/testPreviewImage.cpp @@ -32,6 +32,9 @@ // /////////////////////////////////////////////////////////////////////////// +#ifdef NDEBUG +# undef NDEBUG +#endif #include #include @@ -221,4 +224,3 @@ testPreviewImage (const std::string &tempDir) assert (false); } } - diff --git a/OpenEXR/IlmImfTest/testRgba.cpp b/OpenEXR/IlmImfTest/testRgba.cpp index eff1304122..2484652092 100644 --- a/OpenEXR/IlmImfTest/testRgba.cpp +++ b/OpenEXR/IlmImfTest/testRgba.cpp @@ -32,6 +32,9 @@ // /////////////////////////////////////////////////////////////////////////// +#ifdef NDEBUG +# undef NDEBUG +#endif #include "compareB44.h" #include "compareDwa.h" diff --git a/OpenEXR/IlmImfTest/testRgbaThreading.cpp b/OpenEXR/IlmImfTest/testRgbaThreading.cpp index 7ad2b4a0df..51773a692e 100644 --- a/OpenEXR/IlmImfTest/testRgbaThreading.cpp +++ b/OpenEXR/IlmImfTest/testRgbaThreading.cpp @@ -32,6 +32,9 @@ // /////////////////////////////////////////////////////////////////////////// +#ifdef NDEBUG +# undef NDEBUG +#endif #include "compareB44.h" #include "compareDwa.h" diff --git a/OpenEXR/IlmImfTest/testRle.cpp b/OpenEXR/IlmImfTest/testRle.cpp index 60b25c3f71..97c92ed78c 100644 --- a/OpenEXR/IlmImfTest/testRle.cpp +++ b/OpenEXR/IlmImfTest/testRle.cpp @@ -31,6 +31,10 @@ // /////////////////////////////////////////////////////////////////////////// +#ifdef NDEBUG +# undef NDEBUG +#endif + #include #include #include diff --git a/OpenEXR/IlmImfTest/testSampleImages.cpp b/OpenEXR/IlmImfTest/testSampleImages.cpp index 9c2eb7cb2e..a698594a3a 100644 --- a/OpenEXR/IlmImfTest/testSampleImages.cpp +++ b/OpenEXR/IlmImfTest/testSampleImages.cpp @@ -32,6 +32,10 @@ // /////////////////////////////////////////////////////////////////////////// +#ifdef NDEBUG +# undef NDEBUG +#endif + #include #include #include diff --git a/OpenEXR/IlmImfTest/testScanLineApi.cpp b/OpenEXR/IlmImfTest/testScanLineApi.cpp index 41203652e6..354d2dccf1 100644 --- a/OpenEXR/IlmImfTest/testScanLineApi.cpp +++ b/OpenEXR/IlmImfTest/testScanLineApi.cpp @@ -32,6 +32,9 @@ // /////////////////////////////////////////////////////////////////////////// +#ifdef NDEBUG +# undef NDEBUG +#endif #include #include diff --git a/OpenEXR/IlmImfTest/testSharedFrameBuffer.cpp b/OpenEXR/IlmImfTest/testSharedFrameBuffer.cpp index 87c3074e40..0b2293c23b 100644 --- a/OpenEXR/IlmImfTest/testSharedFrameBuffer.cpp +++ b/OpenEXR/IlmImfTest/testSharedFrameBuffer.cpp @@ -32,6 +32,9 @@ // /////////////////////////////////////////////////////////////////////////// +#ifdef NDEBUG +# undef NDEBUG +#endif #include "compareB44.h" #include "compareDwa.h" diff --git a/OpenEXR/IlmImfTest/testStandardAttributes.cpp b/OpenEXR/IlmImfTest/testStandardAttributes.cpp index d5873a70f5..d2dd0bd8db 100644 --- a/OpenEXR/IlmImfTest/testStandardAttributes.cpp +++ b/OpenEXR/IlmImfTest/testStandardAttributes.cpp @@ -32,6 +32,9 @@ // /////////////////////////////////////////////////////////////////////////// +#ifdef NDEBUG +# undef NDEBUG +#endif #include #include diff --git a/OpenEXR/IlmImfTest/testTiledCompression.cpp b/OpenEXR/IlmImfTest/testTiledCompression.cpp index 74554fb096..6c60e07053 100644 --- a/OpenEXR/IlmImfTest/testTiledCompression.cpp +++ b/OpenEXR/IlmImfTest/testTiledCompression.cpp @@ -32,6 +32,9 @@ // /////////////////////////////////////////////////////////////////////////// +#ifdef NDEBUG +# undef NDEBUG +#endif #include "compareB44.h" #include "compareDwa.h" diff --git a/OpenEXR/IlmImfTest/testTiledCopyPixels.cpp b/OpenEXR/IlmImfTest/testTiledCopyPixels.cpp index c4e036f792..6fa883ba5c 100644 --- a/OpenEXR/IlmImfTest/testTiledCopyPixels.cpp +++ b/OpenEXR/IlmImfTest/testTiledCopyPixels.cpp @@ -32,6 +32,9 @@ // /////////////////////////////////////////////////////////////////////////// +#ifdef NDEBUG +# undef NDEBUG +#endif #include #include diff --git a/OpenEXR/IlmImfTest/testTiledLineOrder.cpp b/OpenEXR/IlmImfTest/testTiledLineOrder.cpp index 5779f9ff22..5be72dc811 100644 --- a/OpenEXR/IlmImfTest/testTiledLineOrder.cpp +++ b/OpenEXR/IlmImfTest/testTiledLineOrder.cpp @@ -32,6 +32,9 @@ // /////////////////////////////////////////////////////////////////////////// +#ifdef NDEBUG +# undef NDEBUG +#endif #include #include diff --git a/OpenEXR/IlmImfTest/testTiledRgba.cpp b/OpenEXR/IlmImfTest/testTiledRgba.cpp index 455479ffec..5104209cc9 100644 --- a/OpenEXR/IlmImfTest/testTiledRgba.cpp +++ b/OpenEXR/IlmImfTest/testTiledRgba.cpp @@ -32,6 +32,9 @@ // /////////////////////////////////////////////////////////////////////////// +#ifdef NDEBUG +# undef NDEBUG +#endif #include "compareB44.h" #include "compareDwa.h" @@ -756,7 +759,7 @@ writeReadLayers(const std::string &tempDir) { for (int x = 0; x < W; ++x) { - if (y < in.numYTiles() / 2 * in.tileYSize()) + if (y < static_cast( (in.numYTiles() / 2) * in.tileYSize())) assert (p3[y][x].r == p1[y][x]); else assert (p3[y][x].r == p2[y][x]); @@ -852,7 +855,7 @@ writeReadLayers(const std::string &tempDir) { for (int x = 0; x < W; ++x) { - if (y < in.numYTiles() / 2 * in.tileYSize()) + if (y < static_cast((in.numYTiles() / 2) * in.tileYSize())) { assert (p3[y][x].r == p1[y][x]); assert (p3[y][x].g == p1[y][x]); diff --git a/OpenEXR/IlmImfTest/testTiledYa.cpp b/OpenEXR/IlmImfTest/testTiledYa.cpp index d2f415a8f1..fe2ddcf465 100644 --- a/OpenEXR/IlmImfTest/testTiledYa.cpp +++ b/OpenEXR/IlmImfTest/testTiledYa.cpp @@ -36,6 +36,9 @@ // ////////////////////////////////////////////////////////////////////////////// +#ifdef NDEBUG +# undef NDEBUG +#endif #include #include diff --git a/OpenEXR/IlmImfTest/testWav.cpp b/OpenEXR/IlmImfTest/testWav.cpp index fa6e5a57f5..dd257d35d6 100644 --- a/OpenEXR/IlmImfTest/testWav.cpp +++ b/OpenEXR/IlmImfTest/testWav.cpp @@ -32,7 +32,9 @@ // /////////////////////////////////////////////////////////////////////////// - +#ifdef NDEBUG +# undef NDEBUG +#endif #include #include "ImathRandom.h" diff --git a/OpenEXR/IlmImfTest/testXdr.cpp b/OpenEXR/IlmImfTest/testXdr.cpp index 4b2ce283a0..63ba69ccd8 100644 --- a/OpenEXR/IlmImfTest/testXdr.cpp +++ b/OpenEXR/IlmImfTest/testXdr.cpp @@ -32,7 +32,9 @@ // /////////////////////////////////////////////////////////////////////////// - +#ifdef NDEBUG +# undef NDEBUG +#endif #include #include diff --git a/OpenEXR/IlmImfTest/testYca.cpp b/OpenEXR/IlmImfTest/testYca.cpp index 9fc3b713b4..573abd26ce 100644 --- a/OpenEXR/IlmImfTest/testYca.cpp +++ b/OpenEXR/IlmImfTest/testYca.cpp @@ -36,6 +36,10 @@ // ////////////////////////////////////////////////////////////////////////////// +#ifdef NDEBUG +# undef NDEBUG +#endif + #include #include #include diff --git a/OpenEXR/IlmImfUtilTest/main.cpp b/OpenEXR/IlmImfUtilTest/main.cpp index c1d9019b8b..dc744be48f 100644 --- a/OpenEXR/IlmImfUtilTest/main.cpp +++ b/OpenEXR/IlmImfUtilTest/main.cpp @@ -32,6 +32,10 @@ // /////////////////////////////////////////////////////////////////////////// +#ifdef NDEBUG +# undef NDEBUG +#endif + #include "ImfNamespace.h" #include "OpenEXRConfigInternal.h" diff --git a/OpenEXR/IlmImfUtilTest/testDeepImage.cpp b/OpenEXR/IlmImfUtilTest/testDeepImage.cpp index 77a4968a4f..5e25363bd3 100644 --- a/OpenEXR/IlmImfUtilTest/testDeepImage.cpp +++ b/OpenEXR/IlmImfUtilTest/testDeepImage.cpp @@ -32,6 +32,9 @@ // /////////////////////////////////////////////////////////////////////////// +#ifdef NDEBUG +# undef NDEBUG +#endif #include #include diff --git a/OpenEXR/IlmImfUtilTest/testFlatImage.cpp b/OpenEXR/IlmImfUtilTest/testFlatImage.cpp index 65e5e1ad6e..d1219b83fa 100644 --- a/OpenEXR/IlmImfUtilTest/testFlatImage.cpp +++ b/OpenEXR/IlmImfUtilTest/testFlatImage.cpp @@ -32,6 +32,9 @@ // /////////////////////////////////////////////////////////////////////////// +#ifdef NDEBUG +# undef NDEBUG +#endif #include #include diff --git a/OpenEXR/IlmImfUtilTest/testIO.cpp b/OpenEXR/IlmImfUtilTest/testIO.cpp index 4e4abac9da..ce9551f181 100644 --- a/OpenEXR/IlmImfUtilTest/testIO.cpp +++ b/OpenEXR/IlmImfUtilTest/testIO.cpp @@ -32,6 +32,9 @@ // /////////////////////////////////////////////////////////////////////////// +#ifdef NDEBUG +# undef NDEBUG +#endif #include #include @@ -112,7 +115,7 @@ testFlatTiledImage1 (const string &fileName) delete img2; } - +#if 0 void testFlatTiledImage2 (const string &fileName) { @@ -134,7 +137,7 @@ testFlatTiledImage2 (const string &fileName) delete img2; } - +#endif void testDeepScanLineImage1 (const string &fileName) diff --git a/OpenEXR/exrstdattr/main.cpp b/OpenEXR/exrstdattr/main.cpp index c65914e97c..3b8388a912 100644 --- a/OpenEXR/exrstdattr/main.cpp +++ b/OpenEXR/exrstdattr/main.cpp @@ -834,7 +834,7 @@ main(int argc, char **argv) { Header h = in.header (part); - for (int i = 0; i < attrs.size(); ++i) + for (size_t i = 0; i < attrs.size(); ++i) { const SetAttr &attr = attrs[i]; diff --git a/OpenEXR_Viewers/exrdisplay/loadImage.cpp b/OpenEXR_Viewers/exrdisplay/loadImage.cpp index 46cf467397..d2cbdab5d5 100644 --- a/OpenEXR_Viewers/exrdisplay/loadImage.cpp +++ b/OpenEXR_Viewers/exrdisplay/loadImage.cpp @@ -868,7 +868,7 @@ loadDeepTileImage (MultiPartInputFile &inmaster, pixels[i].g = dataG[i][0]; pixels[i].b = dataB[i][0]; - for(int s=1; s=1.f) break; diff --git a/OpenEXR_Viewers/playexr/ctlToLut.cpp b/OpenEXR_Viewers/playexr/ctlToLut.cpp index 769bb29f6a..4d799e7ff6 100644 --- a/OpenEXR_Viewers/playexr/ctlToLut.cpp +++ b/OpenEXR_Viewers/playexr/ctlToLut.cpp @@ -450,7 +450,7 @@ ctlToLut (vector transformNames, assert (lutSize % 4 == 0); - for (int i = 0; i < lutSize; i += 4) + for (size_t i = 0; i < lutSize; i += 4) { V3f rgb (pixelValues[i], pixelValues[i + 1], pixelValues[i + 2]); rgb = rgb * M; diff --git a/OpenEXR_Viewers/playexr/playExr.cpp b/OpenEXR_Viewers/playexr/playExr.cpp index 750f9de44c..6068276246 100644 --- a/OpenEXR_Viewers/playexr/playExr.cpp +++ b/OpenEXR_Viewers/playexr/playExr.cpp @@ -880,7 +880,7 @@ init3DLut float g = ig / (lutN - 1.0); half G = exp ((g - lutT) / lutM); - for (int ir = 0; ir < lutN; ++ir) + for (size_t ir = 0; ir < lutN; ++ir) { float r = ir / (lutN - 1.0); half R = exp ((r - lutT) / lutM); @@ -899,7 +899,7 @@ init3DLut Array lut (LUT_SIZE); - for (int i = 0; i < LUT_SIZE; ++i) + for (size_t i = 0; i < LUT_SIZE; ++i) lut[i] = 0; // @@ -916,7 +916,7 @@ init3DLut // produced by the CTL transforms. // - for (int i = 0; i < LUT_SIZE; ++i) + for (size_t i = 0; i < LUT_SIZE; ++i) { if (lut[i] >= HALF_MIN && lut[i] <= HALF_MAX) { diff --git a/PyIlmBase/PyImath/PyImathFixedMatrix.h b/PyIlmBase/PyImath/PyImathFixedMatrix.h index d74400bc50..df97265bc2 100644 --- a/PyIlmBase/PyImath/PyImathFixedMatrix.h +++ b/PyIlmBase/PyImath/PyImathFixedMatrix.h @@ -40,6 +40,10 @@ #include "PyImathFixedArray.h" #include "PyImathOperators.h" +#ifdef __clang__ +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wself-assign-overloaded" +#endif namespace PyImath { // @@ -130,6 +134,7 @@ class FixedMatrix void extract_slice_indices(PyObject *index, Py_ssize_t &start, Py_ssize_t &end, Py_ssize_t &step, Py_ssize_t &slicelength) const { + slicelength = 0; if (PySlice_Check(index)) { #if PY_MAJOR_VERSION > 2 PyObject *slice = index; @@ -540,5 +545,8 @@ static void add_bitwise_math_functions(boost::python::class_ > &c } +#ifdef __clang__ +# pragma clang diagnostic pop +#endif #endif diff --git a/PyIlmBase/PyImath/PyImathLine.cpp b/PyIlmBase/PyImath/PyImathLine.cpp index b332d1ee6c..be114694d5 100644 --- a/PyIlmBase/PyImath/PyImathLine.cpp +++ b/PyIlmBase/PyImath/PyImathLine.cpp @@ -348,8 +348,7 @@ intersect2(Line3 &line, const Vec3 &v0, const Vec3 &v1, const Vec3 & if(IMATH_NAMESPACE::intersect(line, v0, v1, v2, pt, bar, front)) { - tuple t = make_tuple(pt, bar, front); - return t; + return make_tuple (pt, bar, front); } else { @@ -591,5 +590,3 @@ template PYIMATH_EXPORT class_ > register_Line(); template PYIMATH_EXPORT class_ > register_Line(); } // namespace PyImath - - diff --git a/PyIlmBase/PyImath/PyImathVec4Impl.h b/PyIlmBase/PyImath/PyImathVec4Impl.h index 4f1bd4471c..e2a7900c98 100644 --- a/PyIlmBase/PyImath/PyImathVec4Impl.h +++ b/PyIlmBase/PyImath/PyImathVec4Impl.h @@ -872,7 +872,7 @@ notequal(const Vec4 &v, const tuple &t) res.x = extract(t[0]); res.y = extract(t[1]); res.z = extract(t[2]); - res.z = extract(t[3]); + res.w = extract(t[3]); return (v != res); }