summaryrefslogtreecommitdiffstats
path: root/net/disk_cache
diff options
context:
space:
mode:
authorthestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-19 05:28:58 +0000
committerthestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-19 05:28:58 +0000
commitf76184af6b2b63d85d77d71b575a10dc1b6b1255 (patch)
tree85713845c4cb89488ae2aab0c99390b1bd865025 /net/disk_cache
parent63035789c6166164f962c7a37c6ca487d92c2401 (diff)
downloadchromium_src-f76184af6b2b63d85d77d71b575a10dc1b6b1255.zip
chromium_src-f76184af6b2b63d85d77d71b575a10dc1b6b1255.tar.gz
chromium_src-f76184af6b2b63d85d77d71b575a10dc1b6b1255.tar.bz2
Cleanup: avoid foo ? true : false, part 2.
Review URL: https://chromiumcodereview.appspot.com/10942004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@157509 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/disk_cache')
-rw-r--r--net/disk_cache/bitmap.cc4
-rw-r--r--net/disk_cache/entry_impl.cc3
-rw-r--r--net/disk_cache/stress_cache.cc2
3 files changed, 4 insertions, 5 deletions
diff --git a/net/disk_cache/bitmap.cc b/net/disk_cache/bitmap.cc
index 6c9aceb..6d469df 100644
--- a/net/disk_cache/bitmap.cc
+++ b/net/disk_cache/bitmap.cc
@@ -36,7 +36,7 @@ int FindLSBNonEmpty(uint32 word, bool value) {
return FindLSBSetNonZero(word);
}
-}
+} // namespace
namespace disk_cache {
@@ -105,7 +105,7 @@ bool Bitmap::Get(int index) const {
DCHECK_GE(index, 0);
const int i = index & (kIntBits-1);
const int j = index / kIntBits;
- return map_[j] & (1 << i) ? true : false;
+ return ((map_[j] & (1 << i)) != 0);
}
void Bitmap::Toggle(int index) {
diff --git a/net/disk_cache/entry_impl.cc b/net/disk_cache/entry_impl.cc
index 37df0d7..f8c3bb3 100644
--- a/net/disk_cache/entry_impl.cc
+++ b/net/disk_cache/entry_impl.cc
@@ -451,8 +451,7 @@ bool EntryImpl::IsSameEntry(const std::string& key, uint32 hash) {
static_cast<size_t>(entry_.Data()->key_len) != key.size())
return false;
- std::string my_key = GetKey();
- return key.compare(my_key) ? false : true;
+ return (key.compare(GetKey()) == 0);
}
void EntryImpl::InternalDoom() {
diff --git a/net/disk_cache/stress_cache.cc b/net/disk_cache/stress_cache.cc
index 20f63c3..cb63557 100644
--- a/net/disk_cache/stress_cache.cc
+++ b/net/disk_cache/stress_cache.cc
@@ -152,7 +152,7 @@ void StressTheCache(int iteration) {
for (int i = 0;; i++) {
int slot = rand() % kNumEntries;
int key = rand() % kNumKeys;
- bool truncate = rand() % 2 ? false : true;
+ bool truncate = (rand() % 2 == 0);
int size = kSize - (rand() % 20) * kSize / 20;
if (entries[slot])