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

Unified Diff: content/common/child_process_sandbox_support_impl_linux.cc

Issue 141113003: Refactor base/safe_numerics.h (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 6 years, 11 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
Index: content/common/child_process_sandbox_support_impl_linux.cc
===================================================================
--- content/common/child_process_sandbox_support_impl_linux.cc (revision 245415)
+++ content/common/child_process_sandbox_support_impl_linux.cc (working copy)
@@ -8,10 +8,10 @@
#include "base/debug/trace_event.h"
#include "base/memory/scoped_ptr.h"
+#include "base/numerics/safe_conversions.h"
#include "base/pickle.h"
#include "base/posix/eintr_wrapper.h"
#include "base/posix/unix_domain_socket_linux.h"
-#include "base/safe_numerics.h"
#include "base/sys_byteorder.h"
#include "content/common/sandbox_linux/sandbox_linux.h"
#include "third_party/WebKit/public/platform/linux/WebFontFamily.h"
@@ -117,7 +117,7 @@
struct stat st;
if (fstat(fd, &st) < 0)
return false;
- data_length = base::checked_numeric_cast<size_t>(st.st_size);
+ data_length = base::checked_cast<size_t>(st.st_size);
} else {
// Get a font table. Read the header to find its offset in the file.
uint16_t num_tables;
@@ -134,7 +134,7 @@
scoped_ptr<uint8_t[]> table_entries(new uint8_t[directory_size]);
n = HANDLE_EINTR(pread(fd, table_entries.get(), directory_size,
12 /* skip the SFNT header */));
- if (n != base::checked_numeric_cast<ssize_t>(directory_size))
+ if (n != base::checked_cast<ssize_t>(directory_size))
return false;
for (uint16_t i = 0; i < num_tables; ++i) {
@@ -155,7 +155,7 @@
return false;
// Clamp |offset| inside the allowable range. This allows the read to succeed
// but return 0 bytes.
- offset = std::min(offset, base::checked_numeric_cast<off_t>(data_length));
+ offset = std::min(offset, base::checked_cast<off_t>(data_length));
// Make sure it's safe to add the data offset and the caller's logical offset.
// Define the maximum positive offset on 32 bit systems.
static const off_t kMaxPositiveOffset32 = 0x7FFFFFFF; // 2 GB - 1.
@@ -169,7 +169,7 @@
// 'output_length' holds the maximum amount of data the caller can accept.
data_length = std::min(data_length, *output_length);
ssize_t n = HANDLE_EINTR(pread(fd, output, data_length, data_offset));
- if (n != base::checked_numeric_cast<ssize_t>(data_length))
+ if (n != base::checked_cast<ssize_t>(data_length))
return false;
}
*output_length = data_length;
« no previous file with comments | « content/browser/vibration/vibration_provider_android.cc ('k') | content/common/gpu/media/video_encode_accelerator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698