[libromdata/tests] ImageDecoderTest: Change the max file size constants to off64_t.

Fixes a compile warning (error) in the 64-bit MSVC 2015 build on AppVeyor:

extlib\googletest\googletest\include\gtest/gtest.h(1438): error C2220: warning treated as error - no 'object' file generated [build\src\libromdata\tests\ImageDecoderTest.vcxproj]
  src\libromdata\tests\img\ImageDecoderTest.cpp(297): note: see reference to function template instantiation 'testing::AssertionResult testing::internal::CmpHelperLE<off64_t,std::size_t>(const char *,const char *,const T1 &,const T2 &)' being compiled
          with
          [
              T1=off64_t,
              T2=std::size_t
          ]
extlib\googletest\googletest\include\gtest/gtest.h(1438): warning C4018: '<=': signed/unsigned mismatch [build\src\libromdata\tests\ImageDecoderTest.vcxproj]
This commit is contained in:
David Korth 2025-04-01 23:19:24 -04:00
parent e984a074ce
commit 8f4648eb38

View File

@ -134,8 +134,8 @@ struct ImageDecoderTest_mode
};
// Maximum file size for images.
static constexpr size_t MAX_DDS_IMAGE_FILESIZE = 12U*1024U*1024U;
static constexpr size_t MAX_PNG_IMAGE_FILESIZE = 2U*1024U*1024U;
static constexpr off64_t MAX_DDS_IMAGE_FILESIZE = 12U*1024U*1024U;
static constexpr off64_t MAX_PNG_IMAGE_FILESIZE = 2U*1024U*1024U;
class ImageDecoderTest : public ::testing::TestWithParam<ImageDecoderTest_mode>
{
@ -272,11 +272,9 @@ void ImageDecoderTest::SetUp(void)
/* FIXME: Per-type minimum sizes.
* This fails on some very small SVR files.
ASSERT_GT(ddsSize, 4+sizeof(DDS_HEADER))
<< "DDS image is too small.";
ASSERT_GT(ddsSize, 4+sizeof(DDS_HEADER)) << "DDS image is too small.";
*/
ASSERT_LE(ddsSize, MAX_DDS_IMAGE_FILESIZE)
<< "DDS image is too big.";
ASSERT_LE(static_cast<off64_t>(ddsSize), MAX_DDS_IMAGE_FILESIZE) << "DDS image is too big.";
// Read the DDS image into memory.
m_dds_buf.resize(ddsSize);