diff --git a/OgreMain/src/OgreFreeImageCodec2.cpp b/OgreMain/src/OgreFreeImageCodec2.cpp index f9f7b62dad6..d007affe065 100644 --- a/OgreMain/src/OgreFreeImageCodec2.cpp +++ b/OgreMain/src/OgreFreeImageCodec2.cpp @@ -62,6 +62,12 @@ THE SOFTWARE. #include +// We want to be compatible with both FreeImage and FreeImageRe, but first specifies sizes as DWORD and second as uint32_t +// On Windows both DWORD (unsigned long) and uint32_t are separate 32bit types, so pointers to them can not be mixed +#ifndef FISIZE +#define FISIZE decltype( FIICCPROFILE::size ) // DWORD for FreeImage, uint32_t for FreeImageRe +#endif + namespace Ogre { FreeImageCodec2::RegisteredCodecList FreeImageCodec2::msCodecList; @@ -425,7 +431,7 @@ namespace Ogre FreeImage_SaveToMemory( (FREE_IMAGE_FORMAT)mFreeImageType, fiBitmap, mem ); // Grab data information uint8_t *data; - uint32_t size; + FISIZE size; FreeImage_AcquireMemory( mem, &data, &size ); // Copy data into our own buffer // Because we're asking MemoryDataStream to free this, must create in a compatible way