mirror of
https://github.com/yann64/haikuports.git
synced 2026-05-04 22:18:55 +02:00
268 lines
8.2 KiB
Plaintext
268 lines
8.2 KiB
Plaintext
From 2ce1404cb25e6a8dc1b02c7f1dfaf26725edfadf Mon Sep 17 00:00:00 2001
|
|
From: Kacper Kasper <kacperkasper@gmail.com>
|
|
Date: Sat, 16 Dec 2017 12:02:34 +0100
|
|
Subject: gcc2 support
|
|
|
|
|
|
diff --git a/IlmImf/ImfChannelListAttribute.cpp b/IlmImf/ImfChannelListAttribute.cpp
|
|
index 5549493..8fb8800 100644
|
|
--- a/IlmImf/ImfChannelListAttribute.cpp
|
|
+++ b/IlmImf/ImfChannelListAttribute.cpp
|
|
@@ -46,6 +46,19 @@ OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_ENTER
|
|
|
|
namespace {
|
|
|
|
+template <size_t N>
|
|
+void checkIsNullTerminated (char (&str)[N], const char *what)
|
|
+{
|
|
+ for (size_t i = 0; i < N; ++i) {
|
|
+ if (str[i] == '\0')
|
|
+ return;
|
|
+ }
|
|
+ std::stringstream s;
|
|
+ s << "Invalid " << what << ": it is more than " << (N - 1)
|
|
+ << " characters long.";
|
|
+ throw IEX_NAMESPACE::InputExc(s);
|
|
+}
|
|
+
|
|
template <size_t N>
|
|
void checkIsNullTerminated (const char (&str)[N], const char *what)
|
|
{
|
|
diff --git a/IlmImf/ImfCheckedArithmetic.h b/IlmImf/ImfCheckedArithmetic.h
|
|
index 6a7fc15..43da516 100644
|
|
--- a/IlmImf/ImfCheckedArithmetic.h
|
|
+++ b/IlmImf/ImfCheckedArithmetic.h
|
|
@@ -63,8 +63,11 @@ uiMult (T a, T b)
|
|
// Unsigned integer multiplication
|
|
//
|
|
|
|
- IMF_STATIC_ASSERT (!std::numeric_limits<T>::is_signed &&
|
|
- std::numeric_limits<T>::is_integer);
|
|
+ {
|
|
+ const bool c = !std::numeric_limits<T>::is_signed &&
|
|
+ std::numeric_limits<T>::is_integer;
|
|
+ IMF_STATIC_ASSERT (c);
|
|
+ }
|
|
|
|
if (a > 0 && b > std::numeric_limits<T>::max() / a)
|
|
throw IEX_NAMESPACE::OverflowExc ("Integer multiplication overflow.");
|
|
@@ -81,8 +84,11 @@ uiDiv (T a, T b)
|
|
// Unsigned integer division
|
|
//
|
|
|
|
- IMF_STATIC_ASSERT (!std::numeric_limits<T>::is_signed &&
|
|
- std::numeric_limits<T>::is_integer);
|
|
+ {
|
|
+ const bool c = !std::numeric_limits<T>::is_signed &&
|
|
+ std::numeric_limits<T>::is_integer;
|
|
+ IMF_STATIC_ASSERT (c);
|
|
+ }
|
|
|
|
if (b == 0)
|
|
throw IEX_NAMESPACE::DivzeroExc ("Integer division by zero.");
|
|
@@ -99,8 +105,11 @@ uiAdd (T a, T b)
|
|
// Unsigned integer addition
|
|
//
|
|
|
|
- IMF_STATIC_ASSERT (!std::numeric_limits<T>::is_signed &&
|
|
- std::numeric_limits<T>::is_integer);
|
|
+ {
|
|
+ const bool c = !std::numeric_limits<T>::is_signed &&
|
|
+ std::numeric_limits<T>::is_integer;
|
|
+ IMF_STATIC_ASSERT (c);
|
|
+ }
|
|
|
|
if (a > std::numeric_limits<T>::max() - b)
|
|
throw IEX_NAMESPACE::OverflowExc ("Integer addition overflow.");
|
|
@@ -117,8 +126,11 @@ uiSub (T a, T b)
|
|
// Unsigned integer subtraction
|
|
//
|
|
|
|
- IMF_STATIC_ASSERT (!std::numeric_limits<T>::is_signed &&
|
|
- std::numeric_limits<T>::is_integer);
|
|
+ {
|
|
+ const bool c = !std::numeric_limits<T>::is_signed &&
|
|
+ std::numeric_limits<T>::is_integer;
|
|
+ IMF_STATIC_ASSERT (c);
|
|
+ }
|
|
|
|
if (a < b)
|
|
throw IEX_NAMESPACE::UnderflowExc ("Integer subtraction underflow.");
|
|
@@ -145,8 +157,11 @@ checkArraySize (T n, size_t s)
|
|
// size_t (n).
|
|
//
|
|
|
|
- IMF_STATIC_ASSERT (!std::numeric_limits<T>::is_signed &&
|
|
- std::numeric_limits<T>::is_integer);
|
|
+ {
|
|
+ const bool c = !std::numeric_limits<T>::is_signed &&
|
|
+ std::numeric_limits<T>::is_integer;
|
|
+ IMF_STATIC_ASSERT (c);
|
|
+ }
|
|
|
|
IMF_STATIC_ASSERT (sizeof (T) <= sizeof (size_t));
|
|
|
|
diff --git a/IlmImf/ImfFastHuf.cpp b/IlmImf/ImfFastHuf.cpp
|
|
index 86c84dc..01edad4 100644
|
|
--- a/IlmImf/ImfFastHuf.cpp
|
|
+++ b/IlmImf/ImfFastHuf.cpp
|
|
@@ -107,7 +107,7 @@ FastHufDecoder::FastHufDecoder
|
|
for (int i = 0; i <= MAX_CODE_LEN; ++i)
|
|
{
|
|
codeCount[i] = 0;
|
|
- base[i] = 0xffffffffffffffffL;
|
|
+ base[i] = 0xffffffffffffffffLL;
|
|
offset[i] = 0;
|
|
}
|
|
|
|
@@ -352,7 +352,7 @@ FastHufDecoder::buildTables (Int64 *base, Int64 *offset)
|
|
|
|
for (int i = 0; i <= MAX_CODE_LEN; ++i)
|
|
{
|
|
- if (base[i] != 0xffffffffffffffffL)
|
|
+ if (base[i] != 0xffffffffffffffffLL)
|
|
{
|
|
_ljBase[i] = base[i] << (64 - i);
|
|
}
|
|
@@ -362,7 +362,7 @@ FastHufDecoder::buildTables (Int64 *base, Int64 *offset)
|
|
// Unused code length - insert dummy values
|
|
//
|
|
|
|
- _ljBase[i] = 0xffffffffffffffffL;
|
|
+ _ljBase[i] = 0xffffffffffffffffLL;
|
|
}
|
|
}
|
|
|
|
@@ -417,7 +417,7 @@ FastHufDecoder::buildTables (Int64 *base, Int64 *offset)
|
|
|
|
int minIdx = TABLE_LOOKUP_BITS;
|
|
|
|
- while (minIdx > 0 && _ljBase[minIdx] == 0xffffffffffffffffL)
|
|
+ while (minIdx > 0 && _ljBase[minIdx] == 0xffffffffffffffffLL)
|
|
minIdx--;
|
|
|
|
if (minIdx < 0)
|
|
@@ -427,7 +427,7 @@ FastHufDecoder::buildTables (Int64 *base, Int64 *offset)
|
|
// Set the min value such that the table is never tested.
|
|
//
|
|
|
|
- _tableMin = 0xffffffffffffffffL;
|
|
+ _tableMin = 0xffffffffffffffffLL;
|
|
}
|
|
else
|
|
{
|
|
diff --git a/IlmImf/ImfHeader.cpp b/IlmImf/ImfHeader.cpp
|
|
index d6b55f3..212e623 100644
|
|
--- a/IlmImf/ImfHeader.cpp
|
|
+++ b/IlmImf/ImfHeader.cpp
|
|
@@ -114,6 +114,19 @@ initialize (Header &header,
|
|
header.insert ("channels", ChannelListAttribute ());
|
|
}
|
|
|
|
+template <size_t N>
|
|
+void checkIsNullTerminated (char (&str)[N], const char *what)
|
|
+{
|
|
+ for (size_t i = 0; i < N; ++i) {
|
|
+ if (str[i] == '\0')
|
|
+ return;
|
|
+ }
|
|
+ std::stringstream s;
|
|
+ s << "Invalid " << what << ": it is more than " << (N - 1)
|
|
+ << " characters long.";
|
|
+ throw IEX_NAMESPACE::InputExc(s);
|
|
+}
|
|
+
|
|
template <size_t N>
|
|
void checkIsNullTerminated (const char (&str)[N], const char *what)
|
|
{
|
|
diff --git a/IlmImf/ImfStringVectorAttribute.cpp b/IlmImf/ImfStringVectorAttribute.cpp
|
|
index 88fdf8e..bc4f15b 100644
|
|
--- a/IlmImf/ImfStringVectorAttribute.cpp
|
|
+++ b/IlmImf/ImfStringVectorAttribute.cpp
|
|
@@ -65,7 +65,8 @@ StringVectorAttribute::writeValueTo (OPENEXR_IMF_INTERNAL_NAMESPACE::OStream &os
|
|
{
|
|
int strSize = _value[i].size();
|
|
Xdr::write <StreamIO> (os, strSize);
|
|
- Xdr::write <StreamIO> (os, &_value[i][0], strSize);
|
|
+ std::string str = _value[i];
|
|
+ Xdr::write <StreamIO> (os, &str[0], strSize);
|
|
}
|
|
}
|
|
|
|
diff --git a/IlmImf/b44ExpLogTable.cpp b/IlmImf/b44ExpLogTable.cpp
|
|
index 24e35fb..620b090 100644
|
|
--- a/IlmImf/b44ExpLogTable.cpp
|
|
+++ b/IlmImf/b44ExpLogTable.cpp
|
|
@@ -131,6 +131,7 @@ main ()
|
|
}
|
|
|
|
cout << "};\n";
|
|
+ cout.flush();
|
|
|
|
return 0;
|
|
}
|
|
diff --git a/exrenvmap/namespaceAlias.h b/exrenvmap/namespaceAlias.h
|
|
index bf488da..dbe9d9b 100644
|
|
--- a/exrenvmap/namespaceAlias.h
|
|
+++ b/exrenvmap/namespaceAlias.h
|
|
@@ -38,8 +38,8 @@
|
|
#include "ImathNamespace.h"
|
|
#include "IexNamespace.h"
|
|
|
|
-namespace IMF = OPENEXR_IMF_NAMESPACE;
|
|
-namespace IMATH = IMATH_NAMESPACE;
|
|
-namespace IEX = IEX_NAMESPACE;
|
|
+#define IMF OPENEXR_IMF_NAMESPACE
|
|
+#define IMATH IMATH_NAMESPACE
|
|
+#define IEX IEX_NAMESPACE
|
|
|
|
#endif /* NAMESPACEALIAS_H_ */
|
|
diff --git a/exrmaketiled/namespaceAlias.h b/exrmaketiled/namespaceAlias.h
|
|
index 19567eb..92b9c86 100644
|
|
--- a/exrmaketiled/namespaceAlias.h
|
|
+++ b/exrmaketiled/namespaceAlias.h
|
|
@@ -38,8 +38,8 @@
|
|
#include <ImathNamespace.h>
|
|
#include <IexNamespace.h>
|
|
|
|
-namespace IMF = OPENEXR_IMF_NAMESPACE;
|
|
-namespace IMATH = IMATH_NAMESPACE;
|
|
-namespace IEX = IEX_NAMESPACE;
|
|
+#define IMF OPENEXR_IMF_NAMESPACE
|
|
+#define IMATH IMATH_NAMESPACE
|
|
+#define IEX IEX_NAMESPACE
|
|
|
|
#endif /* NAMESPACEALIAS_H_ */
|
|
diff --git a/exrmultipart/exrmultipart.cpp b/exrmultipart/exrmultipart.cpp
|
|
index 8c4fa66..b192dd8 100644
|
|
--- a/exrmultipart/exrmultipart.cpp
|
|
+++ b/exrmultipart/exrmultipart.cpp
|
|
@@ -140,7 +140,7 @@ bool
|
|
is_number(const std::string& s)
|
|
{
|
|
std::string::const_iterator it = s.begin();
|
|
- while (it != s.end() && std::isdigit(*it)) ++it;
|
|
+ while (it != s.end() && isdigit(*it)) ++it;
|
|
return !s.empty() && it == s.end();
|
|
}
|
|
|
|
diff --git a/exrmultiview/namespaceAlias.h b/exrmultiview/namespaceAlias.h
|
|
index 19567eb..92b9c86 100644
|
|
--- a/exrmultiview/namespaceAlias.h
|
|
+++ b/exrmultiview/namespaceAlias.h
|
|
@@ -38,8 +38,8 @@
|
|
#include <ImathNamespace.h>
|
|
#include <IexNamespace.h>
|
|
|
|
-namespace IMF = OPENEXR_IMF_NAMESPACE;
|
|
-namespace IMATH = IMATH_NAMESPACE;
|
|
-namespace IEX = IEX_NAMESPACE;
|
|
+#define IMF OPENEXR_IMF_NAMESPACE
|
|
+#define IMATH IMATH_NAMESPACE
|
|
+#define IEX IEX_NAMESPACE
|
|
|
|
#endif /* NAMESPACEALIAS_H_ */
|
|
--
|
|
2.15.0
|
|
|