Change ErrorCode into an enum class.
This change is needed in order for us to be able to import ErrorCode
symbols from chromeos_update_engine into chromeos_update_manager.
Unfortunately, shifting from plain 'enum' into an 'enum class' means
that the compiler treats the new class as a distinct type from int,
which in turn means that plenty of seamless arithmetic/bitwise
operations we used for manipulating error code values throughout the
code needed to be retrofitted with static_cast operators.
In the future, we should consider imposing a proper abstraction on
update engine error codes that'll prevent mingling with value encoding
directly and prevent such nastiness. It'll also make things more
coherent (types, semantics) and safer.
BUG=chromium:358329
TEST=Unit tests.
Change-Id: Ie55fa566b764cdab6c4785d995fb6daee4cb32d3
Reviewed-on: https://chromium-review.googlesource.com/203209
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
diff --git a/delta_performer.h b/delta_performer.h
index 4338646..8fffffb 100644
--- a/delta_performer.h
+++ b/delta_performer.h
@@ -106,10 +106,10 @@
// Verifies the downloaded payload against the signed hash included in the
// payload, against the update check hash (which is in base64 format) and
- // size using the public key and returns kErrorCodeSuccess on success, an
+ // size using the public key and returns ErrorCode::kSuccess on success, an
// error code on failure. This method should be called after closing the
// stream. Note this method skips the signed hash check if the public key is
- // unavailable; it returns kErrorCodeSignedDeltaPayloadExpectedError if the
+ // unavailable; it returns ErrorCode::kSignedDeltaPayloadExpectedError if the
// public key is available but the delta payload doesn't include a signature.
ErrorCode VerifyPayload(const std::string& update_check_response_hash,
const uint64_t update_check_response_size);
@@ -225,14 +225,14 @@
// Validates that the hash of the blobs corresponding to the given |operation|
// matches what's specified in the manifest in the payload.
- // Returns kErrorCodeSuccess on match or a suitable error code otherwise.
+ // Returns ErrorCode::kSuccess on match or a suitable error code otherwise.
ErrorCode ValidateOperationHash(
const DeltaArchiveManifest_InstallOperation& operation);
// Interprets the given |protobuf| as a DeltaArchiveManifest protocol buffer
// of the given protobuf_length and verifies that the signed hash of the
// metadata matches what's specified in the install plan from Omaha.
- // Returns kErrorCodeSuccess on match or a suitable error code otherwise.
+ // Returns ErrorCode::kSuccess on match or a suitable error code otherwise.
// This method must be called before any part of the |protobuf| is parsed
// so that a man-in-the-middle attack on the SSL connection to the payload
// server doesn't exploit any vulnerability in the code that parses the