Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion source/backend/povray.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,21 @@
extern "C" const char* TIFFGetVersion(void);
#endif
#ifndef OPENEXR_MISSING
#include <IlmBaseConfig.h>
#include <OpenEXRConfig.h>
#if (OPENEXR_VERSION_MAJOR < 3)
#include <IlmBaseConfig.h>
#else
#include <Imath/ImathConfig.h>
#endif
// NOTE:
// Versions of OpenEXR and IlmImf prior to 1.7.1 do not seem to have a way to get the version number,
// nor do the official hard-coded Windows config headers.
#ifndef ILMBASE_PACKAGE_STRING
#define ILMBASE_PACKAGE_STRING "IlmBase"
#endif
#ifndef IMATH_PACKAGE_STRING
#define IMATH_PACKAGE_STRING "Imath"
#endif
#ifndef OPENEXR_PACKAGE_STRING
#define OPENEXR_PACKAGE_STRING "OpenEXR"
#endif
Expand Down Expand Up @@ -458,7 +465,11 @@ void BuildInitInfo(POVMSObjectPtr msg)
err = POVMSAttr_New(&attr);
if(err == kNoErr)
{
#if (OPENEXR_VERSION_MAJOR < 3)
const char *tempstr = OPENEXR_PACKAGE_STRING " and " ILMBASE_PACKAGE_STRING ", Copyright (c) 2002-2011 Industrial Light & Magic.";
#else
const char *tempstr = OPENEXR_PACKAGE_STRING " and " IMATH_PACKAGE_STRING ", Copyright (c) Contributors to the OpenEXR Project.";
#endif
err = POVMSAttr_Set(&attr, kPOVMSType_CString, reinterpret_cast<const void *>(tempstr), (int) strlen(tempstr) + 1);
if(err == kNoErr)
err = POVMSAttrList_Append(&attrlist, &attr);
Expand Down
35 changes: 15 additions & 20 deletions source/base/image/openexr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,21 +46,11 @@

#ifndef OPENEXR_MISSING

#ifdef NON_UNIX_OPENEXR_HEADERS

#include <ImfRgbaFile.h>
#include <ImfStringAttribute.h>
#include <ImfMatrixAttribute.h>
#include <ImfArray.h>

#else

#include <OpenEXR/ImfRgbaFile.h>
#include <OpenEXR/ImfStringAttribute.h>
#include <OpenEXR/ImfMatrixAttribute.h>
#include <OpenEXR/ImfArray.h>

#endif
#include "metadata.h"

// this must be the last file included
Expand All @@ -78,6 +68,11 @@ using namespace Imath;
/*****************************************************************************
* Local preprocessor defines
******************************************************************************/
#if (OPENEXR_VERSION_MAJOR < 3)
#define OPENEXR_INT64 Int64
#else
#define OPENEXR_INT64 uint64_t
#endif

/*****************************************************************************
* Local typedefs
Expand Down Expand Up @@ -105,17 +100,17 @@ class POV_EXR_OStream : public Imf::OStream
throw POV_EXCEPTION(kFileDataErr, "Error while writing EXR output");
}

Int64 tellp()
OPENEXR_INT64 tellp()
{
unsigned long pos = os.tellg();
POV_LONG pos = os.tellg();
if((int) pos == -1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While you're at it, all unsigned long in the file should be considered a bug. They should either be POV_LONG (v3.7) / POV_OFF_T (v3.8) or whatever we'll be using instead of Int64.

Same goes for the comparison with -1 here and further below: There's a bug lurking in there as well, and it should instead be something like if(pos == POV_LONG(-1)) (or correspondingly for v3.8).

throw POV_EXCEPTION(kFileDataErr, "Error while writing EXR output");
return(pos);
}

void seekp(Int64 pos)
void seekp(OPENEXR_INT64 pos)
{
if(!os.seekg((unsigned long)pos))
if(!os.seekg((POV_LONG)pos))
throw POV_EXCEPTION(kFileDataErr, "Error when writing EXR output");
}
private:
Expand Down Expand Up @@ -147,22 +142,22 @@ class POV_EXR_IStream : public Imf::IStream
return (is.tellg() < fsize);
}

Int64 tellg()
OPENEXR_INT64 tellg()
{
unsigned long pos = is.tellg();
POV_LONG pos = is.tellg();
if((int)pos == -1)
throw POV_EXCEPTION(kFileDataErr, "Error while reading EXR file");
return pos;
}

void seekg(Int64 pos)
void seekg(OPENEXR_INT64 pos)
{
if(!is.seekg((unsigned long)pos))
if(!is.seekg((POV_LONG)pos))
throw POV_EXCEPTION(kFileDataErr, "Error while reading EXR file");
}
private:
pov_base::IStream& is;
unsigned long fsize;
POV_LONG fsize;
};

/*****************************************************************************
Expand Down Expand Up @@ -282,7 +277,7 @@ void Write(OStream *file, const Image *image, const Image::WriteOptions& options
comments += meta.getComment3() + "\n";
if (!meta.getComment4().empty())
comments += meta.getComment4() + "\n";

if (!comments.empty())
hdr.insert("comments",StringAttribute(comments.c_str()));

Expand Down
12 changes: 3 additions & 9 deletions unix/config/ax_check_openexr.m4
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#
# LAST MODIFICATION
#
# 2007-11-08
# 2021-06-15
#
# COPYLEFT
#
Expand Down Expand Up @@ -46,17 +46,11 @@ AC_DEFUN([AX_CHECK_OPENEXR],
ax_check_openexr_save_cppflags="$CPPFLAGS"
ax_check_openexr_save_libs="$LIBS"
CPPFLAGS="$ax_check_openexr_cflags $CPPFLAGS"
LIBS="$ax_check_openexr_libs $LIBS"

# FIXME: workaround for versions >= 1.4.0
AX_COMPARE_VERSION([$ax_check_openexr_version], [ge], [1.4],
[LIBS="$ax_check_openexr_libs -lIlmThread $LIBS"],
[LIBS="$ax_check_openexr_libs $LIBS"]
)

# check include file
AC_CHECK_HEADER(
[OpenEXR/ImfCRgbaFile.h],
[AC_CHECK_LIB([IlmImf], [ImfInputReadPixels], [], [ax_check_openexr="not found"])],
[ax_check_openexr="ok"],
[ax_check_openexr="no headers"]
)
fi
Expand Down
10 changes: 5 additions & 5 deletions windows/vs10/povbase.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
<Optimization>Disabled</Optimization>
<IntrinsicFunctions>true</IntrinsicFunctions>
<AdditionalIncludeDirectories>..\..\libraries\ilmbase\config.windows;..\..\libraries\openexr\config.windows;..\..\libraries\openexr\IlmImf;..\..\libraries\ilmbase\Half;..\..\libraries\ilmbase\Imath;..\..\libraries\ilmbase\Iex;..\..\libraries\boost;..\..\vfe\win;..\..\vfe;..\..\source;..\..\source\base;..\..\source\backend;..\..\source\frontend;..\..\libraries\jpeg;..\..\libraries\zlib;..\..\libraries\png;..\..\libraries\tiff\libtiff;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>BOOST_ALL_NO_LIB;NON_UNIX_OPENEXR_HEADERS;_DEBUG;WIN32;WIN32_LEAN_AND_MEAN;_WINDOWS;WINVER=0x0500;_WIN32_WINNT=0x0500;COMMONCTRL_VERSION=0x500;CLASSLIB_DEFS_H;NOMINMAX;ISOLATION_AWARE_ENABLED;_CRT_SECURE_NO_DEPRECATE;_HAS_ITERATOR_DEBUGGING=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>BOOST_ALL_NO_LIB;_DEBUG;WIN32;WIN32_LEAN_AND_MEAN;_WINDOWS;WINVER=0x0500;_WIN32_WINNT=0x0500;COMMONCTRL_VERSION=0x500;CLASSLIB_DEFS_H;NOMINMAX;ISOLATION_AWARE_ENABLED;_CRT_SECURE_NO_DEPRECATE;_HAS_ITERATOR_DEBUGGING=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<ExceptionHandling>Sync</ExceptionHandling>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
Expand Down Expand Up @@ -165,7 +165,7 @@
<Optimization>Disabled</Optimization>
<IntrinsicFunctions>true</IntrinsicFunctions>
<AdditionalIncludeDirectories>..\..\libraries\ilmbase\config.windows;..\..\libraries\openexr\config.windows;..\..\libraries\openexr\IlmImf;..\..\libraries\ilmbase\Half;..\..\libraries\ilmbase\Imath;..\..\libraries\ilmbase\Iex;..\..\libraries\boost;..\..\vfe\win\;..\..\vfe\;..\..\source;..\..\source\base;..\..\source\backend;..\..\source\frontend;..\..\libraries\jpeg;..\..\libraries\zlib;..\..\libraries\png;..\..\libraries\tiff\libtiff;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>BOOST_ALL_NO_LIB;NON_UNIX_OPENEXR_HEADERS;_DEBUG;WIN32;WIN32_LEAN_AND_MEAN;_WINDOWS;CLASSLIB_DEFS_H;NOMINMAX;ISOLATION_AWARE_ENABLED;_CRT_SECURE_NO_DEPRECATE;_HAS_ITERATOR_DEBUGGING=0;BUILDING_AMD64=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>BOOST_ALL_NO_LIB;_DEBUG;WIN32;WIN32_LEAN_AND_MEAN;_WINDOWS;CLASSLIB_DEFS_H;NOMINMAX;ISOLATION_AWARE_ENABLED;_CRT_SECURE_NO_DEPRECATE;_HAS_ITERATOR_DEBUGGING=0;BUILDING_AMD64=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<ExceptionHandling>Sync</ExceptionHandling>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
Expand Down Expand Up @@ -212,7 +212,7 @@
<EnableFiberSafeOptimizations>false</EnableFiberSafeOptimizations>
<WholeProgramOptimization>true</WholeProgramOptimization>
<AdditionalIncludeDirectories>..\..\libraries\ilmbase\config.windows;..\..\libraries\openexr\config.windows;..\..\libraries\openexr\IlmImf;..\..\libraries\ilmbase\Half;..\..\libraries\ilmbase\Imath;..\..\libraries\ilmbase\Iex;..\..\libraries\boost;..\..\vfe\win;..\..\vfe;..\..\source;..\..\source\base;..\..\source\backend;..\..\source\frontend;..\..\libraries\jpeg;..\..\libraries\zlib;..\..\libraries\png;..\..\libraries\tiff\libtiff;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>BOOST_ALL_NO_LIB;NON_UNIX_OPENEXR_HEADERS;NDEBUG;WIN32;WIN32_LEAN_AND_MEAN;_WINDOWS;COMMONCTRL_VERSION=0x500;CLASSLIB_DEFS_H;WINVER=0x0500;_WIN32_WINNT=0x0500;NOMINMAX;ISOLATION_AWARE_ENABLED;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>BOOST_ALL_NO_LIB;NDEBUG;WIN32;WIN32_LEAN_AND_MEAN;_WINDOWS;COMMONCTRL_VERSION=0x500;CLASSLIB_DEFS_H;WINVER=0x0500;_WIN32_WINNT=0x0500;NOMINMAX;ISOLATION_AWARE_ENABLED;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<ExceptionHandling>Sync</ExceptionHandling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
Expand Down Expand Up @@ -262,7 +262,7 @@
<OmitFramePointers>false</OmitFramePointers>
<EnableFiberSafeOptimizations>false</EnableFiberSafeOptimizations>
<AdditionalIncludeDirectories>..\..\libraries\ilmbase\config.windows;..\..\libraries\openexr\config.windows;..\..\libraries\openexr\IlmImf;..\..\libraries\ilmbase\Half;..\..\libraries\ilmbase\Imath;..\..\libraries\ilmbase\Iex;..\..\libraries\boost;..\..\vfe\win\;..\..\vfe\;..\..\source;..\..\source\base;..\..\source\backend;..\..\source\frontend;..\..\libraries\jpeg;..\..\libraries\zlib;..\..\libraries\png;..\..\libraries\tiff\libtiff;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>BOOST_ALL_NO_LIB;NON_UNIX_OPENEXR_HEADERS;NDEBUG;WIN32;WIN32_LEAN_AND_MEAN;_WINDOWS;CLASSLIB_DEFS_H;NOMINMAX;ISOLATION_AWARE_ENABLED;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL=0;BUILDING_AMD64=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>BOOST_ALL_NO_LIB;NDEBUG;WIN32;WIN32_LEAN_AND_MEAN;_WINDOWS;CLASSLIB_DEFS_H;NOMINMAX;ISOLATION_AWARE_ENABLED;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL=0;BUILDING_AMD64=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<ExceptionHandling>Sync</ExceptionHandling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
Expand Down Expand Up @@ -309,7 +309,7 @@
<EnableFiberSafeOptimizations>false</EnableFiberSafeOptimizations>
<WholeProgramOptimization>true</WholeProgramOptimization>
<AdditionalIncludeDirectories>..\..\libraries\ilmbase\config.windows;..\..\libraries\openexr\config.windows;..\..\libraries\openexr\IlmImf;..\..\libraries\ilmbase\Half;..\..\libraries\ilmbase\Imath;..\..\libraries\ilmbase\Iex;..\..\libraries\boost;..\..\vfe\win\;..\..\vfe\;..\..\source;..\..\source\base;..\..\source\backend;..\..\source\frontend;..\..\libraries\jpeg;..\..\libraries\zlib;..\..\libraries\png;..\..\libraries\tiff\libtiff;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>BOOST_ALL_NO_LIB;NON_UNIX_OPENEXR_HEADERS;NDEBUG;WIN32;WIN32_LEAN_AND_MEAN;_WINDOWS;COMMONCTRL_VERSION=0x500;CLASSLIB_DEFS_H;WINVER=0x0500;_WIN32_WINNT=0x0500;NOMINMAX;ISOLATION_AWARE_ENABLED;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL=0;BUILD_SSE2=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>BOOST_ALL_NO_LIB;NDEBUG;WIN32;WIN32_LEAN_AND_MEAN;_WINDOWS;COMMONCTRL_VERSION=0x500;CLASSLIB_DEFS_H;WINVER=0x0500;_WIN32_WINNT=0x0500;NOMINMAX;ISOLATION_AWARE_ENABLED;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL=0;BUILD_SSE2=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<ExceptionHandling>Sync</ExceptionHandling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
Expand Down