From 9573f1edcc2a4cb41cb5434424f225e410b6fdbe Mon Sep 17 00:00:00 2001 From: Luis Diaz Date: Tue, 11 Jan 2022 08:52:30 +0100 Subject: [PATCH] Fix MSVC warnings by casting integer values --- unitTests/test_bmpimage.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/unitTests/test_bmpimage.cpp b/unitTests/test_bmpimage.cpp index 86764fd8..30a9eaa9 100644 --- a/unitTests/test_bmpimage.cpp +++ b/unitTests/test_bmpimage.cpp @@ -90,7 +90,7 @@ TEST(BmpImage, readMetadataReadsImageDimensionsWhenDataIsAvailable) 0x20, 0x03, 0x00, 0x00, // The bitmap height in pixels (unsigned 16 bit) off:22, size:4 }; - auto memIo = std::make_unique(header.data(), header.size()); + auto memIo = std::make_unique(header.data(), static_cast(header.size())); BmpImage bmp(std::move(memIo)); ASSERT_NO_THROW(bmp.readMetadata()); ASSERT_EQ(1280, bmp.pixelWidth()); @@ -110,7 +110,7 @@ TEST(BmpImage, readMetadataThrowsWhenImageIsNotBMP) 0x20, 0x03, 0x00, 0x00, // The bitmap height in pixels (unsigned 16 bit) off:22, size:4 }; - auto memIo = std::make_unique(header.data(), header.size()); + auto memIo = std::make_unique(header.data(), static_cast(header.size())); BmpImage bmp(std::move(memIo)); try { bmp.readMetadata(); @@ -124,7 +124,7 @@ TEST(BmpImage, readMetadataThrowsWhenImageIsNotBMP) TEST(BmpImage, readMetadataThrowsWhenThereIsNotEnoughInfoToRead) { const std::array header{'B'}; - auto memIo = std::make_unique(header.data(), header.size()); + auto memIo = std::make_unique(header.data(), static_cast(header.size())); BmpImage bmp(std::move(memIo)); try { bmp.readMetadata(); @@ -157,7 +157,7 @@ TEST(newBmpInstance, createsValidInstace) 0x00, 0x00, // Reserved 0x00, 0x00, 0x00, 0x00 // Offset of the byte where the bitmap image data can be found }; - auto memIo = std::make_unique(bitmapHeader.data(), bitmapHeader.size()); + auto memIo = std::make_unique(bitmapHeader.data(), static_cast(bitmapHeader.size())); auto img = newBmpInstance(std::move(memIo), false); ASSERT_TRUE(img->good()); } @@ -178,7 +178,7 @@ TEST(isBmpType, withValidSignatureReturnsTrue) 0x00, 0x00, // Reserved 0x00, 0x00, 0x00, 0x00 // Offset of the byte where the bitmap image data can be found }; - MemIo memIo(bitmapHeader.data(), bitmapHeader.size()); + MemIo memIo(bitmapHeader.data(), static_cast(bitmapHeader.size())); ASSERT_TRUE(isBmpType(memIo, false)); } @@ -191,6 +191,6 @@ TEST(isBmpType, withInvalidSignatureReturnsFalse) 0x00, 0x00, // Reserved 0x00, 0x00, 0x00, 0x00 // Offset of the byte where the bitmap image data can be found }; - MemIo memIo(bitmapHeader.data(), bitmapHeader.size()); + MemIo memIo(bitmapHeader.data(), static_cast(bitmapHeader.size())); ASSERT_FALSE(isBmpType(memIo, false)); }