summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/angle/src/libANGLE/Error.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/angle/src/libANGLE/Error.cpp')
-rw-r--r--src/3rdparty/angle/src/libANGLE/Error.cpp48
1 files changed, 33 insertions, 15 deletions
diff --git a/src/3rdparty/angle/src/libANGLE/Error.cpp b/src/3rdparty/angle/src/libANGLE/Error.cpp
index e17f26bec4..fed1594972 100644
--- a/src/3rdparty/angle/src/libANGLE/Error.cpp
+++ b/src/3rdparty/angle/src/libANGLE/Error.cpp
@@ -16,9 +16,16 @@
namespace gl
{
-Error::Error(GLenum errorCode, const char *msg, ...)
- : mCode(errorCode),
- mMessage(nullptr)
+Error::Error(GLenum errorCode, const char *msg, ...) : mCode(errorCode), mID(errorCode)
+{
+ va_list vararg;
+ va_start(vararg, msg);
+ createMessageString();
+ *mMessage = FormatString(msg, vararg);
+ va_end(vararg);
+}
+
+Error::Error(GLenum errorCode, GLuint id, const char *msg, ...) : mCode(errorCode), mID(id)
{
va_list vararg;
va_start(vararg, msg);
@@ -29,9 +36,9 @@ Error::Error(GLenum errorCode, const char *msg, ...)
void Error::createMessageString() const
{
- if (mMessage == nullptr)
+ if (!mMessage)
{
- mMessage = new std::string();
+ mMessage.reset(new std::string);
}
}
@@ -41,15 +48,28 @@ const std::string &Error::getMessage() const
return *mMessage;
}
+bool Error::operator==(const Error &other) const
+{
+ if (mCode != other.mCode)
+ return false;
+
+ // TODO(jmadill): Compare extended error codes instead of strings.
+ if ((!mMessage || !other.mMessage) && (!mMessage != !other.mMessage))
+ return false;
+
+ return (*mMessage == *other.mMessage);
+}
+
+bool Error::operator!=(const Error &other) const
+{
+ return !(*this == other);
+}
}
namespace egl
{
-Error::Error(EGLint errorCode, const char *msg, ...)
- : mCode(errorCode),
- mID(0),
- mMessage(nullptr)
+Error::Error(EGLint errorCode, const char *msg, ...) : mCode(errorCode), mID(0)
{
va_list vararg;
va_start(vararg, msg);
@@ -58,10 +78,7 @@ Error::Error(EGLint errorCode, const char *msg, ...)
va_end(vararg);
}
-Error::Error(EGLint errorCode, EGLint id, const char *msg, ...)
- : mCode(errorCode),
- mID(id),
- mMessage(nullptr)
+Error::Error(EGLint errorCode, EGLint id, const char *msg, ...) : mCode(errorCode), mID(id)
{
va_list vararg;
va_start(vararg, msg);
@@ -69,11 +86,12 @@ Error::Error(EGLint errorCode, EGLint id, const char *msg, ...)
*mMessage = FormatString(msg, vararg);
va_end(vararg);
}
+
void Error::createMessageString() const
{
- if (mMessage == nullptr)
+ if (!mMessage)
{
- mMessage = new std::string();
+ mMessage.reset(new std::string);
}
}