diff options
author | mhm@chromium.org <mhm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-01 02:48:05 +0000 |
---|---|---|
committer | mhm@chromium.org <mhm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-01 02:48:05 +0000 |
commit | 5d2b449b4f0b3d13c75e540c834c550ed38c0912 (patch) | |
tree | 6224e6d93676677f19fb03e7d80b46ea15dcf3b5 /base | |
parent | c4e678d0902b04606ff2a21714e33643d01a74ed (diff) | |
download | chromium_src-5d2b449b4f0b3d13c75e540c834c550ed38c0912.zip chromium_src-5d2b449b4f0b3d13c75e540c834c550ed38c0912.tar.gz chromium_src-5d2b449b4f0b3d13c75e540c834c550ed38c0912.tar.bz2 |
More DCHECK() updates. A mixture of _EQ and _GE.
Bug=58409
Review URL: http://codereview.chromium.org/6469070
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@76343 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r-- | base/event_recorder.cc | 4 | ||||
-rw-r--r-- | base/i18n/bidi_line_iterator.cc | 2 | ||||
-rw-r--r-- | base/message_pump_libevent.cc | 2 | ||||
-rw-r--r-- | base/message_pump_win.cc | 2 | ||||
-rw-r--r-- | base/pickle.h | 4 | ||||
-rw-r--r-- | base/platform_file_posix.cc | 2 | ||||
-rw-r--r-- | base/shared_memory_posix.cc | 8 | ||||
-rw-r--r-- | base/shared_memory_win.cc | 4 | ||||
-rw-r--r-- | base/synchronization/condition_variable_posix.cc | 12 | ||||
-rw-r--r-- | base/synchronization/waitable_event_win.cc | 2 | ||||
-rw-r--r-- | base/threading/thread_local_storage_win.cc | 2 | ||||
-rw-r--r-- | base/tracked_objects.cc | 2 | ||||
-rw-r--r-- | base/win/scoped_bstr.cc | 2 | ||||
-rw-r--r-- | base/win/scoped_comptr.h | 6 | ||||
-rw-r--r-- | base/win/scoped_variant.cc | 2 |
15 files changed, 28 insertions, 28 deletions
diff --git a/base/event_recorder.cc b/base/event_recorder.cc index 7c3336b..1119b4f 100644 --- a/base/event_recorder.cc +++ b/base/event_recorder.cc @@ -49,7 +49,7 @@ bool EventRecorder::StartRecording(const FilePath& filename) { return false; // Open the recording file. - DCHECK(file_ == NULL); + DCHECK(!file_); file_ = file_util::OpenFile(filename, "wb+"); if (!file_) { DLOG(ERROR) << "EventRecorder could not open log file"; @@ -100,7 +100,7 @@ bool EventRecorder::StartPlayback(const FilePath& filename) { return false; // Open the recording file. - DCHECK(file_ == NULL); + DCHECK(!file_); file_ = file_util::OpenFile(filename, "rb"); if (!file_) { DLOG(ERROR) << "EventRecorder Playback could not open log file"; diff --git a/base/i18n/bidi_line_iterator.cc b/base/i18n/bidi_line_iterator.cc index 3222a3a..5e9cd11 100644 --- a/base/i18n/bidi_line_iterator.cc +++ b/base/i18n/bidi_line_iterator.cc @@ -22,7 +22,7 @@ BiDiLineIterator::~BiDiLineIterator() { bool BiDiLineIterator::Open(const string16& text, bool right_to_left, bool url) { - DCHECK(bidi_ == NULL); + DCHECK(!bidi_); UErrorCode error = U_ZERO_ERROR; bidi_ = ubidi_openSized(static_cast<int>(text.length()), 0, &error); if (U_FAILURE(error)) diff --git a/base/message_pump_libevent.cc b/base/message_pump_libevent.cc index 933d795..28b4bfe 100644 --- a/base/message_pump_libevent.cc +++ b/base/message_pump_libevent.cc @@ -78,7 +78,7 @@ bool MessagePumpLibevent::FileDescriptorWatcher::StopWatchingFileDescriptor() { void MessagePumpLibevent::FileDescriptorWatcher::Init(event *e, bool is_persistent) { DCHECK(e); - DCHECK(event_ == NULL); + DCHECK(!event_); is_persistent_ = is_persistent; event_ = e; diff --git a/base/message_pump_win.cc b/base/message_pump_win.cc index d3f3621..6098a4a 100644 --- a/base/message_pump_win.cc +++ b/base/message_pump_win.cc @@ -470,7 +470,7 @@ void MessagePumpForIO::DoRunLoop() { void MessagePumpForIO::WaitForWork() { // We do not support nested IO message loops. This is to avoid messy // recursion problems. - DCHECK(state_->run_depth == 1) << "Cannot nest an IO message loop!"; + DCHECK_EQ(1, state_->run_depth) << "Cannot nest an IO message loop!"; int timeout = GetCurrentDelay(); if (timeout < 0) // Negative value means no timers waiting. diff --git a/base/pickle.h b/base/pickle.h index 052aa33..9d449ae 100644 --- a/base/pickle.h +++ b/base/pickle.h @@ -147,12 +147,12 @@ class Pickle { // to the Pickle constructor. template <class T> T* headerT() { - DCHECK(sizeof(T) == header_size_); + DCHECK_EQ(header_size_, sizeof(T)); return static_cast<T*>(header_); } template <class T> const T* headerT() const { - DCHECK(sizeof(T) == header_size_); + DCHECK_EQ(header_size_, sizeof(T)); return static_cast<const T*>(header_); } diff --git a/base/platform_file_posix.cc b/base/platform_file_posix.cc index 38989c6..00249aa 100644 --- a/base/platform_file_posix.cc +++ b/base/platform_file_posix.cc @@ -65,7 +65,7 @@ PlatformFile CreatePlatformFile(const FilePath& name, int flags, open_flags |= O_TRUNC; } - DCHECK(O_RDONLY == 0); + COMPILE_ASSERT(O_RDONLY == 0, O_RDONLY_must_equal_zero); int descriptor = open(name.value().c_str(), open_flags, S_IRUSR | S_IWUSR); diff --git a/base/shared_memory_posix.cc b/base/shared_memory_posix.cc index cafda5a..8dc9463 100644 --- a/base/shared_memory_posix.cc +++ b/base/shared_memory_posix.cc @@ -99,7 +99,7 @@ bool SharedMemory::CreateAnonymous(uint32 size) { // of mem_filename after FilePathForMemoryName(). bool SharedMemory::CreateNamed(const std::string& name, bool open_existing, uint32 size) { - DCHECK(mapped_file_ == -1); + DCHECK_EQ(-1, mapped_file_); if (size == 0) return false; // This function theoretically can block on the disk, but realistically @@ -245,7 +245,7 @@ void SharedMemory::Unlock() { } bool SharedMemory::PrepareMapFile(FILE *fp) { - DCHECK(mapped_file_ == -1); + DCHECK_EQ(-1, mapped_file_); if (fp == NULL) return false; // This function theoretically can block on the disk, but realistically @@ -280,8 +280,8 @@ bool SharedMemory::FilePathForMemoryName(const std::string& mem_name, FilePath* path) { // mem_name will be used for a filename; make sure it doesn't // contain anything which will confuse us. - DCHECK(mem_name.find('/') == std::string::npos); - DCHECK(mem_name.find('\0') == std::string::npos); + DCHECK_EQ(std::string::npos, mem_name.find('/')); + DCHECK_EQ(std::string::npos, mem_name.find('\0')); FilePath temp_dir; if (!file_util::GetShmemTempDir(&temp_dir)) diff --git a/base/shared_memory_win.cc b/base/shared_memory_win.cc index 15c61dd..526132c 100644 --- a/base/shared_memory_win.cc +++ b/base/shared_memory_win.cc @@ -80,7 +80,7 @@ bool SharedMemory::CreateAnonymous(uint32 size) { bool SharedMemory::CreateNamed(const std::string& name, bool open_existing, uint32 size) { - DCHECK(mapped_file_ == NULL); + DCHECK(!mapped_file_); if (size == 0) return false; @@ -119,7 +119,7 @@ bool SharedMemory::Delete(const std::string& name) { } bool SharedMemory::Open(const std::string& name, bool read_only) { - DCHECK(mapped_file_ == NULL); + DCHECK(!mapped_file_); name_ = ASCIIToWide(name); read_only_ = read_only; diff --git a/base/synchronization/condition_variable_posix.cc b/base/synchronization/condition_variable_posix.cc index eff7053..fc68b64 100644 --- a/base/synchronization/condition_variable_posix.cc +++ b/base/synchronization/condition_variable_posix.cc @@ -20,12 +20,12 @@ ConditionVariable::ConditionVariable(Lock* user_lock) #endif { int rv = pthread_cond_init(&condition_, NULL); - DCHECK(rv == 0); + DCHECK_EQ(0, rv); } ConditionVariable::~ConditionVariable() { int rv = pthread_cond_destroy(&condition_); - DCHECK(rv == 0); + DCHECK_EQ(0, rv); } void ConditionVariable::Wait() { @@ -33,7 +33,7 @@ void ConditionVariable::Wait() { user_lock_->CheckHeldAndUnmark(); #endif int rv = pthread_cond_wait(&condition_, user_mutex_); - DCHECK(rv == 0); + DCHECK_EQ(0, rv); #if !defined(NDEBUG) user_lock_->CheckUnheldAndMark(); #endif @@ -52,7 +52,7 @@ void ConditionVariable::TimedWait(const TimeDelta& max_time) { Time::kNanosecondsPerMicrosecond; abstime.tv_sec += abstime.tv_nsec / Time::kNanosecondsPerSecond; abstime.tv_nsec %= Time::kNanosecondsPerSecond; - DCHECK(abstime.tv_sec >= now.tv_sec); // Overflow paranoia + DCHECK_GE(abstime.tv_sec, now.tv_sec); // Overflow paranoia #if !defined(NDEBUG) user_lock_->CheckHeldAndUnmark(); @@ -66,12 +66,12 @@ void ConditionVariable::TimedWait(const TimeDelta& max_time) { void ConditionVariable::Broadcast() { int rv = pthread_cond_broadcast(&condition_); - DCHECK(rv == 0); + DCHECK_EQ(0, rv); } void ConditionVariable::Signal() { int rv = pthread_cond_signal(&condition_); - DCHECK(rv == 0); + DCHECK_EQ(0, rv); } } // namespace base diff --git a/base/synchronization/waitable_event_win.cc b/base/synchronization/waitable_event_win.cc index 0fcf488..a0e39c1 100644 --- a/base/synchronization/waitable_event_win.cc +++ b/base/synchronization/waitable_event_win.cc @@ -50,7 +50,7 @@ bool WaitableEvent::Wait() { DWORD result = WaitForSingleObject(handle_, INFINITE); // It is most unexpected that this should ever fail. Help consumers learn // about it if it should ever fail. - DCHECK(result == WAIT_OBJECT_0) << "WaitForSingleObject failed"; + DCHECK_EQ(WAIT_OBJECT_0, result) << "WaitForSingleObject failed"; return result == WAIT_OBJECT_0; } diff --git a/base/threading/thread_local_storage_win.cc b/base/threading/thread_local_storage_win.cc index 667d1b9..c8128f1 100644 --- a/base/threading/thread_local_storage_win.cc +++ b/base/threading/thread_local_storage_win.cc @@ -47,7 +47,7 @@ void** ThreadLocalStorage::Initialize() { TlsFree(value); } } - DCHECK(TlsGetValue(tls_key_) == NULL); + DCHECK(!TlsGetValue(tls_key_)); // Create an array to store our data. void** tls_data = new void*[kThreadLocalStorageSize]; diff --git a/base/tracked_objects.cc b/base/tracked_objects.cc index a9f81b1..d10603d 100644 --- a/base/tracked_objects.cc +++ b/base/tracked_objects.cc @@ -467,7 +467,7 @@ bool ThreadData::StartTracking(bool status) { return true; } base::AutoLock lock(list_lock_); - DCHECK(status_ == UNINITIALIZED); + DCHECK_EQ(UNINITIALIZED, status_); CHECK(tls_index_.Initialize(NULL)); status_ = ACTIVE; return true; diff --git a/base/win/scoped_bstr.cc b/base/win/scoped_bstr.cc index 18ffe6a..63ade0c 100644 --- a/base/win/scoped_bstr.cc +++ b/base/win/scoped_bstr.cc @@ -39,7 +39,7 @@ void ScopedBstr::Swap(ScopedBstr& bstr2) { } BSTR* ScopedBstr::Receive() { - DCHECK(bstr_ == NULL) << "BSTR leak."; + DCHECK(!bstr_) << "BSTR leak."; return &bstr_; } diff --git a/base/win/scoped_comptr.h b/base/win/scoped_comptr.h index 6375218..e508ef2 100644 --- a/base/win/scoped_comptr.h +++ b/base/win/scoped_comptr.h @@ -69,7 +69,7 @@ class ScopedComPtr : public scoped_refptr<Interface> { // Accepts an interface pointer that has already been addref-ed. void Attach(Interface* p) { - DCHECK(ptr_ == NULL); + DCHECK(!ptr_); ptr_ = p; } @@ -78,7 +78,7 @@ class ScopedComPtr : public scoped_refptr<Interface> { // The function DCHECKs on the current value being NULL. // Usage: Foo(p.Receive()); Interface** Receive() { - DCHECK(ptr_ == NULL) << "Object leak. Pointer must be NULL"; + DCHECK(!ptr_) << "Object leak. Pointer must be NULL"; return &ptr_; } @@ -114,7 +114,7 @@ class ScopedComPtr : public scoped_refptr<Interface> { // Convenience wrapper around CoCreateInstance HRESULT CreateInstance(const CLSID& clsid, IUnknown* outer = NULL, DWORD context = CLSCTX_ALL) { - DCHECK(ptr_ == NULL); + DCHECK(!ptr_); HRESULT hr = ::CoCreateInstance(clsid, outer, context, *interface_id, reinterpret_cast<void**>(&ptr_)); return hr; diff --git a/base/win/scoped_variant.cc b/base/win/scoped_variant.cc index 40ccdf2..f57ab93 100644 --- a/base/win/scoped_variant.cc +++ b/base/win/scoped_variant.cc @@ -211,7 +211,7 @@ void ScopedVariant::Set(SAFEARRAY* array) { var_.vt |= VT_ARRAY; var_.parray = array; } else { - DCHECK(array == NULL) << "Unable to determine safearray vartype"; + DCHECK(!array) << "Unable to determine safearray vartype"; var_.vt = VT_EMPTY; } } |