summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/angle/src/libANGLE/Error.inl
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/angle/src/libANGLE/Error.inl')
-rw-r--r--src/3rdparty/angle/src/libANGLE/Error.inl66
1 files changed, 31 insertions, 35 deletions
diff --git a/src/3rdparty/angle/src/libANGLE/Error.inl b/src/3rdparty/angle/src/libANGLE/Error.inl
index 32e8f05828..900fc5fd03 100644
--- a/src/3rdparty/angle/src/libANGLE/Error.inl
+++ b/src/3rdparty/angle/src/libANGLE/Error.inl
@@ -15,15 +15,15 @@ namespace gl
Error::Error(GLenum errorCode)
: mCode(errorCode),
- mMessage(nullptr)
+ mID(errorCode)
{
}
Error::Error(const Error &other)
: mCode(other.mCode),
- mMessage(nullptr)
+ mID(other.mID)
{
- if (other.mMessage != nullptr)
+ if (other.mMessage)
{
createMessageString();
*mMessage = *(other.mMessage);
@@ -32,28 +32,24 @@ Error::Error(const Error &other)
Error::Error(Error &&other)
: mCode(other.mCode),
- mMessage(other.mMessage)
-{
- other.mMessage = nullptr;
-}
-
-Error::~Error()
+ mID(other.mID),
+ mMessage(std::move(other.mMessage))
{
- SafeDelete(mMessage);
}
Error &Error::operator=(const Error &other)
{
mCode = other.mCode;
+ mID = other.mID;
- if (other.mMessage != nullptr)
+ if (other.mMessage)
{
createMessageString();
*mMessage = *(other.mMessage);
}
else
{
- SafeDelete(mMessage);
+ mMessage.release();
}
return *this;
@@ -61,10 +57,12 @@ Error &Error::operator=(const Error &other)
Error &Error::operator=(Error &&other)
{
- mCode = other.mCode;
- mMessage = other.mMessage;
-
- other.mMessage = nullptr;
+ if (this != &other)
+ {
+ mCode = other.mCode;
+ mID = other.mID;
+ mMessage = std::move(other.mMessage);
+ }
return *this;
}
@@ -74,6 +72,11 @@ GLenum Error::getCode() const
return mCode;
}
+GLuint Error::getID() const
+{
+ return mID;
+}
+
bool Error::isError() const
{
return (mCode != GL_NO_ERROR);
@@ -86,17 +89,15 @@ namespace egl
Error::Error(EGLint errorCode)
: mCode(errorCode),
- mID(0),
- mMessage(nullptr)
+ mID(0)
{
}
Error::Error(const Error &other)
: mCode(other.mCode),
- mID(other.mID),
- mMessage(nullptr)
+ mID(other.mID)
{
- if (other.mMessage != nullptr)
+ if (other.mMessage)
{
createMessageString();
*mMessage = *(other.mMessage);
@@ -106,14 +107,8 @@ Error::Error(const Error &other)
Error::Error(Error &&other)
: mCode(other.mCode),
mID(other.mID),
- mMessage(other.mMessage)
-{
- other.mMessage = nullptr;
-}
-
-Error::~Error()
+ mMessage(std::move(other.mMessage))
{
- SafeDelete(mMessage);
}
Error &Error::operator=(const Error &other)
@@ -121,14 +116,14 @@ Error &Error::operator=(const Error &other)
mCode = other.mCode;
mID = other.mID;
- if (other.mMessage != nullptr)
+ if (other.mMessage)
{
createMessageString();
*mMessage = *(other.mMessage);
}
else
{
- SafeDelete(mMessage);
+ mMessage.release();
}
return *this;
@@ -136,11 +131,12 @@ Error &Error::operator=(const Error &other)
Error &Error::operator=(Error &&other)
{
- mCode = other.mCode;
- mID = other.mID;
- mMessage = other.mMessage;
-
- other.mMessage = nullptr;
+ if (this != &other)
+ {
+ mCode = other.mCode;
+ mID = other.mID;
+ mMessage = std::move(other.mMessage);
+ }
return *this;
}