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

Unified Diff: media/cdm/simple_cdm_buffer.cc

Issue 1802183002: Convert CreateCdmBuffer() to use size_t for |capacity| (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove cast Created 4 years, 9 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 | « media/cdm/simple_cdm_buffer.h ('k') | media/mojo/common/mojo_shared_buffer_video_frame.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/cdm/simple_cdm_buffer.cc
diff --git a/media/cdm/simple_cdm_buffer.cc b/media/cdm/simple_cdm_buffer.cc
index c5f3b8bbf96d0e88d159cb81d49e299a1ad148f8..712c8b7b03b5ac47ed7a8242e2792e1eaac3a987 100644
--- a/media/cdm/simple_cdm_buffer.cc
+++ b/media/cdm/simple_cdm_buffer.cc
@@ -4,14 +4,20 @@
#include "media/cdm/simple_cdm_buffer.h"
+#include <limits>
+
#include "base/logging.h"
+#include "base/numerics/safe_conversions.h"
namespace media {
// static
-SimpleCdmBuffer* SimpleCdmBuffer::Create(uint32_t capacity) {
+SimpleCdmBuffer* SimpleCdmBuffer::Create(size_t capacity) {
DCHECK(capacity);
- return new SimpleCdmBuffer(capacity);
+
+ // cdm::Buffer interface limits capacity to uint32.
+ DCHECK_LE(capacity, std::numeric_limits<uint32_t>::max());
+ return new SimpleCdmBuffer(base::checked_cast<uint32_t>(capacity));
}
SimpleCdmBuffer::SimpleCdmBuffer(uint32_t capacity)
« no previous file with comments | « media/cdm/simple_cdm_buffer.h ('k') | media/mojo/common/mojo_shared_buffer_video_frame.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698