Blob Blame History Raw
diff -rupN --no-dereference freeimage-svn-r1889-FreeImage-trunk/Source/FreeImage/PluginEXR.cpp freeimage-svn-r1889-FreeImage-trunk-new/Source/FreeImage/PluginEXR.cpp
--- freeimage-svn-r1889-FreeImage-trunk/Source/FreeImage/PluginEXR.cpp	2021-08-19 10:57:56.740162903 +0200
+++ freeimage-svn-r1889-FreeImage-trunk-new/Source/FreeImage/PluginEXR.cpp	2021-08-19 10:57:56.843165225 +0200
@@ -37,8 +37,22 @@
 #include <OpenEXR/ImfRgba.h>
 #include <OpenEXR/ImfArray.h>
 #include <OpenEXR/ImfPreviewImage.h>
-#include <OpenEXR/half.h>
-
+// The version can reliably be found in this header file from OpenEXR,
+// for both 2.x and 3.x:
+#include <OpenEXR/OpenEXRConfig.h>
+#define COMBINED_OPENEXR_VERSION ((10000*OPENEXR_VERSION_MAJOR) + \
+                                  (100*OPENEXR_VERSION_MINOR) + \
+                                  OPENEXR_VERSION_PATCH)
+
+// There's just no easy way to have an `#include` that works in both
+// cases, so we use the version to switch which set of include files we
+// use.
+#if COMBINED_OPENEXR_VERSION >= 20599 /* 2.5.99: pre-3.0 */
+#   include <Imath/half.h>
+#else
+    // OpenEXR 2.x, use the old locations
+#   include <OpenEXR/half.h>
+#endif
 
 // ==========================================================
 // Plugin Interface
@@ -66,11 +80,11 @@ public:
 		return ((unsigned)n != _io->read_proc(c, 1, n, _handle));
 	}
 
-	virtual Imath::Int64 tellg() {
+	virtual uint64_t tellg() {
 		return _io->tell_proc(_handle);
 	}
 
-	virtual void seekg(Imath::Int64 pos) {
+	virtual void seekg(uint64_t pos) {
 		_io->seek_proc(_handle, (unsigned)pos, SEEK_SET);
 	}
 
@@ -100,11 +114,11 @@ public:
 		}
 	}
 
-	virtual Imath::Int64 tellp() {
+	virtual uint64_t tellp() {
 		return _io->tell_proc(_handle);
 	}
 
-	virtual void seekp(Imath::Int64 pos) {
+	virtual void seekp(uint64_t pos) {
 		_io->seek_proc(_handle, (unsigned)pos, SEEK_SET);
 	}
 };
diff -rupN --no-dereference freeimage-svn-r1889-FreeImage-trunk/Source/FreeImage/PluginTIFF.cpp freeimage-svn-r1889-FreeImage-trunk-new/Source/FreeImage/PluginTIFF.cpp
--- freeimage-svn-r1889-FreeImage-trunk/Source/FreeImage/PluginTIFF.cpp	2021-08-19 10:57:56.742162948 +0200
+++ freeimage-svn-r1889-FreeImage-trunk-new/Source/FreeImage/PluginTIFF.cpp	2021-08-19 10:57:56.843165225 +0200
@@ -39,7 +39,24 @@
 #include "Utilities.h"
 #include <tiffio.h>
 #include "../Metadata/FreeImageTag.h"
-#include <OpenEXR/half.h>
+// The version can reliably be found in this header file from OpenEXR,
+// for both 2.x and 3.x:
+#include <OpenEXR/OpenEXRConfig.h>
+#define COMBINED_OPENEXR_VERSION ((10000*OPENEXR_VERSION_MAJOR) + \
+                                  (100*OPENEXR_VERSION_MINOR) + \
+                                  OPENEXR_VERSION_PATCH)
+
+// There's just no easy way to have an `#include` that works in both
+// cases, so we use the version to switch which set of include files we
+// use.
+#if COMBINED_OPENEXR_VERSION >= 20599 /* 2.5.99: pre-3.0 */
+#   include <Imath/ImathVec.h>
+#   include <Imath/half.h>
+#else
+    // OpenEXR 2.x, use the old locations
+#   include <OpenEXR/ImathVec.h>
+#   include <OpenEXR/half.h>
+#endif
 
 #include "FreeImageIO.h"
 #include "PSDParser.h"