From 8f4648eb38e121df4d0b901f20332be8ce396b86 Mon Sep 17 00:00:00 2001 From: David Korth Date: Tue, 1 Apr 2025 23:19:24 -0400 Subject: [PATCH] [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(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] --- src/libromdata/tests/img/ImageDecoderTest.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/libromdata/tests/img/ImageDecoderTest.cpp b/src/libromdata/tests/img/ImageDecoderTest.cpp index bd159ffae..46f392735 100644 --- a/src/libromdata/tests/img/ImageDecoderTest.cpp +++ b/src/libromdata/tests/img/ImageDecoderTest.cpp @@ -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 { @@ -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(ddsSize), MAX_DDS_IMAGE_FILESIZE) << "DDS image is too big."; // Read the DDS image into memory. m_dds_buf.resize(ddsSize);