summaryrefslogtreecommitdiff
path: root/src/core/hle/result.h
diff options
context:
space:
mode:
authorGravatar Lioncash2019-11-12 04:45:21 -0500
committerGravatar Lioncash2019-11-12 07:55:38 -0500
commitef060ed40c009c4d7b46a0979aa99c117861bc21 (patch)
tree9a085f4e0c2cb82ac4dce0e5e6f611af78792423 /src/core/hle/result.h
parentcrypto: Resolve sign-conversion warnings (diff)
downloadyuzu-ef060ed40c009c4d7b46a0979aa99c117861bc21.tar.gz
yuzu-ef060ed40c009c4d7b46a0979aa99c117861bc21.tar.xz
yuzu-ef060ed40c009c4d7b46a0979aa99c117861bc21.zip
result: Add default error code for the ResultCode(-1) case
Will be used to reduce the overall duplication of the same magic value all over the codebase in following changes.
Diffstat (limited to 'src/core/hle/result.h')
-rw-r--r--src/core/hle/result.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/core/hle/result.h b/src/core/hle/result.h
index 500ea882c..450f61fea 100644
--- a/src/core/hle/result.h
+++ b/src/core/hle/result.h
@@ -147,6 +147,14 @@ constexpr bool operator!=(const ResultCode& a, const ResultCode& b) {
147constexpr ResultCode RESULT_SUCCESS(0); 147constexpr ResultCode RESULT_SUCCESS(0);
148 148
149/** 149/**
150 * Placeholder result code used for unknown error codes.
151 *
152 * @note This should only be used when a particular error code
153 * is not known yet.
154 */
155constexpr ResultCode RESULT_UNKNOWN(UINT32_MAX);
156
157/**
150 * This is an optional value type. It holds a `ResultCode` and, if that code is a success code, 158 * This is an optional value type. It holds a `ResultCode` and, if that code is a success code,
151 * also holds a result of type `T`. If the code is an error code then trying to access the inner 159 * also holds a result of type `T`. If the code is an error code then trying to access the inner
152 * value fails, thus ensuring that the ResultCode of functions is always checked properly before 160 * value fails, thus ensuring that the ResultCode of functions is always checked properly before
@@ -183,7 +191,7 @@ class ResultVal {
183public: 191public:
184 /// Constructs an empty `ResultVal` with the given error code. The code must not be a success 192 /// Constructs an empty `ResultVal` with the given error code. The code must not be a success
185 /// code. 193 /// code.
186 ResultVal(ResultCode error_code = ResultCode(UINT32_MAX)) : result_code(error_code) { 194 ResultVal(ResultCode error_code = RESULT_UNKNOWN) : result_code(error_code) {
187 ASSERT(error_code.IsError()); 195 ASSERT(error_code.IsError());
188 } 196 }
189 197