Skip to content

Commit

Permalink
Preserve ability to build with original FreeImage (Win)
Browse files Browse the repository at this point in the history
  • Loading branch information
eugenegff committed Mar 7, 2024
1 parent 6078c7a commit e019362
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion OgreMain/src/OgreFreeImageCodec2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ THE SOFTWARE.

#include <sstream>

// 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;
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit e019362

Please sign in to comment.