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

Unified Diff: net/disk_cache/blockfile/file_posix.cc

Issue 1492403002: Remove kuint32max. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: http security header file Created 5 years 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 | « net/disk_cache/blockfile/file_ios.cc ('k') | net/dns/dns_response.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/disk_cache/blockfile/file_posix.cc
diff --git a/net/disk_cache/blockfile/file_posix.cc b/net/disk_cache/blockfile/file_posix.cc
index 828673f9b306dc9467fc038d9cabbac6d1eb0998..26067fb0436dc4b430dd674b8501809d41302a73 100644
--- a/net/disk_cache/blockfile/file_posix.cc
+++ b/net/disk_cache/blockfile/file_posix.cc
@@ -4,6 +4,10 @@
#include "net/disk_cache/blockfile/file.h"
+#include <stdint.h>
+
+#include <limits>
+
#include "base/bind.h"
#include "base/lazy_instance.h"
#include "base/location.h"
@@ -56,8 +60,8 @@ bool File::IsValid() const {
bool File::Read(void* buffer, size_t buffer_len, size_t offset) {
DCHECK(base_file_.IsValid());
- if (buffer_len > static_cast<size_t>(kint32max) ||
- offset > static_cast<size_t>(kint32max)) {
+ if (buffer_len > static_cast<size_t>(std::numeric_limits<int32_t>::max()) ||
+ offset > static_cast<size_t>(std::numeric_limits<int32_t>::max())) {
return false;
}
@@ -67,8 +71,8 @@ bool File::Read(void* buffer, size_t buffer_len, size_t offset) {
bool File::Write(const void* buffer, size_t buffer_len, size_t offset) {
DCHECK(base_file_.IsValid());
- if (buffer_len > static_cast<size_t>(kint32max) ||
- offset > static_cast<size_t>(kint32max)) {
+ if (buffer_len > static_cast<size_t>(std::numeric_limits<int32_t>::max()) ||
+ offset > static_cast<size_t>(std::numeric_limits<int32_t>::max())) {
return false;
}
@@ -86,8 +90,8 @@ bool File::Read(void* buffer, size_t buffer_len, size_t offset,
return Read(buffer, buffer_len, offset);
}
- if (buffer_len > static_cast<size_t>(kint32max) ||
- offset > static_cast<size_t>(kint32max)) {
+ if (buffer_len > static_cast<size_t>(std::numeric_limits<int32_t>::max()) ||
+ offset > static_cast<size_t>(std::numeric_limits<int32_t>::max())) {
return false;
}
@@ -109,8 +113,8 @@ bool File::Write(const void* buffer, size_t buffer_len, size_t offset,
return Write(buffer, buffer_len, offset);
}
- if (buffer_len > static_cast<size_t>(kint32max) ||
- offset > static_cast<size_t>(kint32max)) {
+ if (buffer_len > static_cast<size_t>(std::numeric_limits<int32_t>::max()) ||
+ offset > static_cast<size_t>(std::numeric_limits<int32_t>::max())) {
return false;
}
@@ -125,7 +129,7 @@ bool File::Write(const void* buffer, size_t buffer_len, size_t offset,
bool File::SetLength(size_t length) {
DCHECK(base_file_.IsValid());
- if (length > kuint32max)
+ if (length > std::numeric_limits<uint32_t>::max())
return false;
return base_file_.SetLength(length);
@@ -133,10 +137,10 @@ bool File::SetLength(size_t length) {
size_t File::GetLength() {
DCHECK(base_file_.IsValid());
- int64 len = base_file_.GetLength();
+ int64_t len = base_file_.GetLength();
- if (len > static_cast<int64>(kuint32max))
- return kuint32max;
+ if (len > static_cast<int64_t>(std::numeric_limits<uint32_t>::max()))
+ return std::numeric_limits<uint32_t>::max();
return static_cast<size_t>(len);
}
« no previous file with comments | « net/disk_cache/blockfile/file_ios.cc ('k') | net/dns/dns_response.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698