diff options
author | Tao Bao <tbao@google.com> | 2017-10-06 16:37:21 +0200 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2017-10-06 16:37:21 +0200 |
commit | d999ced1d119d78645e1b458dfc3574729d5ac20 (patch) | |
tree | bea09e79cd5bd6d853d3e8b16fbc17a0f04508fb | |
parent | Merge "vr_ui: drawing changes" (diff) | |
parent | Don't include "error_code.h" in edify/expr.h. (diff) | |
download | android_bootable_recovery-d999ced1d119d78645e1b458dfc3574729d5ac20.tar android_bootable_recovery-d999ced1d119d78645e1b458dfc3574729d5ac20.tar.gz android_bootable_recovery-d999ced1d119d78645e1b458dfc3574729d5ac20.tar.bz2 android_bootable_recovery-d999ced1d119d78645e1b458dfc3574729d5ac20.tar.lz android_bootable_recovery-d999ced1d119d78645e1b458dfc3574729d5ac20.tar.xz android_bootable_recovery-d999ced1d119d78645e1b458dfc3574729d5ac20.tar.zst android_bootable_recovery-d999ced1d119d78645e1b458dfc3574729d5ac20.zip |
-rw-r--r-- | edify/expr.cpp | 9 | ||||
-rw-r--r-- | edify/expr.h | 38 | ||||
-rw-r--r-- | error_code.h | 6 | ||||
-rw-r--r-- | updater/updater.cpp | 1 |
4 files changed, 28 insertions, 26 deletions
diff --git a/edify/expr.cpp b/edify/expr.cpp index 54ab3325c..403162d6d 100644 --- a/edify/expr.cpp +++ b/edify/expr.cpp @@ -31,6 +31,8 @@ #include <android-base/stringprintf.h> #include <android-base/strings.h> +#include "error_code.h" + // Functions should: // // - return a malloc()'d string @@ -416,8 +418,5 @@ Value* ErrorAbort(State* state, CauseCode cause_code, const char* format, ...) { return nullptr; } -State::State(const std::string& script, void* cookie) : - script(script), - cookie(cookie) { -} - +State::State(const std::string& script, void* cookie) + : script(script), cookie(cookie), error_code(kNoError), cause_code(kNoCause) {} diff --git a/edify/expr.h b/edify/expr.h index 4838d20c0..32828028a 100644 --- a/edify/expr.h +++ b/edify/expr.h @@ -23,32 +23,34 @@ #include <string> #include <vector> -#include "error_code.h" +// Forward declaration to avoid including "error_code.h". +enum ErrorCode : int; +enum CauseCode : int; struct State { - State(const std::string& script, void* cookie); + State(const std::string& script, void* cookie); - // The source of the original script. - const std::string& script; + // The source of the original script. + const std::string& script; - // Optional pointer to app-specific data; the core of edify never - // uses this value. - void* cookie; + // Optional pointer to app-specific data; the core of edify never + // uses this value. + void* cookie; - // The error message (if any) returned if the evaluation aborts. - // Should be empty initially, will be either empty or a string that - // Evaluate() returns. - std::string errmsg; + // The error message (if any) returned if the evaluation aborts. + // Should be empty initially, will be either empty or a string that + // Evaluate() returns. + std::string errmsg; - // error code indicates the type of failure (e.g. failure to update system image) - // during the OTA process. - ErrorCode error_code = kNoError; + // error code indicates the type of failure (e.g. failure to update system image) + // during the OTA process. + ErrorCode error_code; - // cause code provides more detailed reason of an OTA failure (e.g. fsync error) - // in addition to the error code. - CauseCode cause_code = kNoCause; + // cause code provides more detailed reason of an OTA failure (e.g. fsync error) + // in addition to the error code. + CauseCode cause_code; - bool is_retry = false; + bool is_retry = false; }; enum ValueType { diff --git a/error_code.h b/error_code.h index 4e3032bc9..26b9bb40d 100644 --- a/error_code.h +++ b/error_code.h @@ -17,7 +17,7 @@ #ifndef _ERROR_CODE_H_ #define _ERROR_CODE_H_ -enum ErrorCode { +enum ErrorCode : int { kNoError = -1, kLowBattery = 20, kZipVerificationFailure, @@ -30,7 +30,7 @@ enum ErrorCode { kUpdateBinaryCommandFailure, }; -enum CauseCode { +enum CauseCode : int { kNoCause = -1, kArgsParsingFailure = 100, kStashCreationFailure, @@ -51,7 +51,7 @@ enum CauseCode { kVendorFailure = 200 }; -enum UncryptErrorCode { +enum UncryptErrorCode : int { kUncryptNoError = -1, kUncryptErrorPlaceholder = 50, kUncryptTimeoutError = 100, diff --git a/updater/updater.cpp b/updater/updater.cpp index e10174f71..309c309a5 100644 --- a/updater/updater.cpp +++ b/updater/updater.cpp @@ -31,6 +31,7 @@ #include <ziparchive/zip_archive.h> #include "edify/expr.h" +#include "error_code.h" #include "otafault/config.h" #include "otautil/DirUtil.h" #include "otautil/SysUtil.h" |