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

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

Issue 1499423004: Remove kint32max. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@kint9
Patch Set: rebase 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/entry_impl.h ('k') | net/disk_cache/blockfile/entry_impl_v3.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/disk_cache/blockfile/entry_impl.cc
diff --git a/net/disk_cache/blockfile/entry_impl.cc b/net/disk_cache/blockfile/entry_impl.cc
index c26026e2d788a65bc9064f475b0a2289d13c69e9..1d86e08e01ba3e4ada616eedda1f9352ba03c6a1 100644
--- a/net/disk_cache/blockfile/entry_impl.cc
+++ b/net/disk_cache/blockfile/entry_impl.cc
@@ -4,6 +4,8 @@
#include "net/disk_cache/blockfile/entry_impl.h"
+#include <limits>
+
#include "base/hash.h"
#include "base/message_loop/message_loop.h"
#include "base/strings/string_util.h"
@@ -350,7 +352,9 @@ int EntryImpl::WriteDataImpl(int index, int offset, IOBuffer* buf, int buf_len,
return result;
}
-int EntryImpl::ReadSparseDataImpl(int64 offset, IOBuffer* buf, int buf_len,
+int EntryImpl::ReadSparseDataImpl(int64_t offset,
+ IOBuffer* buf,
+ int buf_len,
const CompletionCallback& callback) {
DCHECK(node_.Data()->dirty || read_only_);
int result = InitSparseData();
@@ -364,7 +368,9 @@ int EntryImpl::ReadSparseDataImpl(int64 offset, IOBuffer* buf, int buf_len,
return result;
}
-int EntryImpl::WriteSparseDataImpl(int64 offset, IOBuffer* buf, int buf_len,
+int EntryImpl::WriteSparseDataImpl(int64_t offset,
+ IOBuffer* buf,
+ int buf_len,
const CompletionCallback& callback) {
DCHECK(node_.Data()->dirty || read_only_);
int result = InitSparseData();
@@ -378,7 +384,7 @@ int EntryImpl::WriteSparseDataImpl(int64 offset, IOBuffer* buf, int buf_len,
return result;
}
-int EntryImpl::GetAvailableRangeImpl(int64 offset, int len, int64* start) {
+int EntryImpl::GetAvailableRangeImpl(int64_t offset, int len, int64_t* start) {
int result = InitSparseData();
if (net::OK != result)
return result;
@@ -398,12 +404,13 @@ int EntryImpl::ReadyForSparseIOImpl(const CompletionCallback& callback) {
return sparse_->ReadyToUse(callback);
}
-uint32 EntryImpl::GetHash() {
+uint32_t EntryImpl::GetHash() {
return entry_.Data()->hash;
}
-bool EntryImpl::CreateEntry(Addr node_address, const std::string& key,
- uint32 hash) {
+bool EntryImpl::CreateEntry(Addr node_address,
+ const std::string& key,
+ uint32_t hash) {
Trace("Create entry In");
EntryStore* entry_store = entry_.Data();
RankingsNode* node = node_.Data();
@@ -417,7 +424,7 @@ bool EntryImpl::CreateEntry(Addr node_address, const std::string& key,
entry_store->hash = hash;
entry_store->creation_time = Time::Now().ToInternalValue();
- entry_store->key_len = static_cast<int32>(key.size());
+ entry_store->key_len = static_cast<int32_t>(key.size());
if (entry_store->key_len > kMaxInternalKeyLength) {
Addr address(0);
if (!CreateBlock(entry_store->key_len + 1, &address))
@@ -442,14 +449,14 @@ bool EntryImpl::CreateEntry(Addr node_address, const std::string& key,
memcpy(entry_store->key, key.data(), key.size());
entry_store->key[key.size()] = '\0';
}
- backend_->ModifyStorageSize(0, static_cast<int32>(key.size()));
- CACHE_UMA(COUNTS, "KeySize", 0, static_cast<int32>(key.size()));
+ backend_->ModifyStorageSize(0, static_cast<int32_t>(key.size()));
+ CACHE_UMA(COUNTS, "KeySize", 0, static_cast<int32_t>(key.size()));
node->dirty = backend_->GetCurrentEntryId();
Log("Create Entry ");
return true;
}
-bool EntryImpl::IsSameEntry(const std::string& key, uint32 hash) {
+bool EntryImpl::IsSameEntry(const std::string& key, uint32_t hash) {
if (entry_.Data()->hash != hash ||
static_cast<size_t>(entry_.Data()->key_len) != key.size())
return false;
@@ -546,7 +553,7 @@ bool EntryImpl::Update() {
return true;
}
-void EntryImpl::SetDirtyFlag(int32 current_id) {
+void EntryImpl::SetDirtyFlag(int32_t current_id) {
DCHECK(node_.HasData());
if (node_.Data()->dirty && current_id != node_.Data()->dirty)
dirty_ = true;
@@ -555,7 +562,7 @@ void EntryImpl::SetDirtyFlag(int32 current_id) {
dirty_ = true;
}
-void EntryImpl::SetPointerForInvalidEntry(int32 new_id) {
+void EntryImpl::SetPointerForInvalidEntry(int32_t new_id) {
node_.Data()->dirty = new_id;
node_.Store();
}
@@ -800,7 +807,7 @@ Time EntryImpl::GetLastModified() const {
return Time::FromInternalValue(node->Data()->last_modified);
}
-int32 EntryImpl::GetDataSize(int index) const {
+int32_t EntryImpl::GetDataSize(int index) const {
if (index < 0 || index >= kNumStreams)
return 0;
@@ -851,7 +858,9 @@ int EntryImpl::WriteData(int index, int offset, IOBuffer* buf, int buf_len,
return net::ERR_IO_PENDING;
}
-int EntryImpl::ReadSparseData(int64 offset, IOBuffer* buf, int buf_len,
+int EntryImpl::ReadSparseData(int64_t offset,
+ IOBuffer* buf,
+ int buf_len,
const CompletionCallback& callback) {
if (callback.is_null())
return ReadSparseDataImpl(offset, buf, buf_len, callback);
@@ -863,7 +872,9 @@ int EntryImpl::ReadSparseData(int64 offset, IOBuffer* buf, int buf_len,
return net::ERR_IO_PENDING;
}
-int EntryImpl::WriteSparseData(int64 offset, IOBuffer* buf, int buf_len,
+int EntryImpl::WriteSparseData(int64_t offset,
+ IOBuffer* buf,
+ int buf_len,
const CompletionCallback& callback) {
if (callback.is_null())
return WriteSparseDataImpl(offset, buf, buf_len, callback);
@@ -875,7 +886,9 @@ int EntryImpl::WriteSparseData(int64 offset, IOBuffer* buf, int buf_len,
return net::ERR_IO_PENDING;
}
-int EntryImpl::GetAvailableRange(int64 offset, int len, int64* start,
+int EntryImpl::GetAvailableRange(int64_t offset,
+ int len,
+ int64_t* start,
const CompletionCallback& callback) {
if (!background_queue_.get())
return net::ERR_UNEXPECTED;
@@ -1077,7 +1090,7 @@ int EntryImpl::InternalWriteData(int index, int offset,
offset + buf_len > max_file_size) {
int size = offset + buf_len;
if (size <= max_file_size)
- size = kint32max;
+ size = std::numeric_limits<int32_t>::max();
backend_->TooMuchStorageRequested(size);
return net::ERR_FAILED;
}
@@ -1499,12 +1512,12 @@ int EntryImpl::InitSparseData() {
return result;
}
-void EntryImpl::SetEntryFlags(uint32 flags) {
+void EntryImpl::SetEntryFlags(uint32_t flags) {
entry_.Data()->flags |= flags;
entry_.set_modified();
}
-uint32 EntryImpl::GetEntryFlags() {
+uint32_t EntryImpl::GetEntryFlags() {
return entry_.Data()->flags;
}
« no previous file with comments | « net/disk_cache/blockfile/entry_impl.h ('k') | net/disk_cache/blockfile/entry_impl_v3.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698