Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(120)

Unified Diff: media/cdm/stub/stub_cdm.cc

Issue 1326413003: Use checked_cast<> to avoid compile errors on Windows (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/cdm/stub/stub_cdm.cc
diff --git a/media/cdm/stub/stub_cdm.cc b/media/cdm/stub/stub_cdm.cc
index 0bfa25ebaa09c617e7906ce5b639d754125de91f..9fb15924d9c842ca19fdfc8c05d7d18388e51304 100644
--- a/media/cdm/stub/stub_cdm.cc
+++ b/media/cdm/stub/stub_cdm.cc
@@ -5,6 +5,7 @@
#include "media/cdm/stub/stub_cdm.h"
#include "base/logging.h"
+#include "base/numerics/safe_conversions.h"
#include "base/strings/string_number_conversions.h"
// Version number for this stub. The third number represents the
@@ -61,9 +62,11 @@ void StubCdm::CreateSessionAndGenerateRequest(
// Provide a dummy message (with a trivial session ID) to enable some testing
// and be consistent with existing testing without a license server.
std::string session_id(base::UintToString(next_session_id_++));
- host_->OnResolveNewSessionPromise(promise_id, session_id.data(),
- session_id.length());
- host_->OnSessionMessage(session_id.data(), session_id.length(),
+ host_->OnResolveNewSessionPromise(
+ promise_id, session_id.data(),
+ base::checked_cast<uint32_t>(session_id.length()));
+ host_->OnSessionMessage(session_id.data(),
+ base::checked_cast<uint32_t>(session_id.length()),
cdm::kLicenseRequest, nullptr, 0, nullptr, 0);
}
@@ -156,7 +159,8 @@ void StubCdm::OnQueryOutputProtectionStatus(
void StubCdm::FailRequest(uint32 promise_id) {
std::string message("Operation not supported by stub CDM.");
host_->OnRejectPromise(promise_id, cdm::kInvalidAccessError, 0,
- message.data(), message.length());
+ message.data(),
+ base::checked_cast<uint32_t>(message.length()));
}
} // namespace media
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698