Replace ASSERT by RTC_DCHECK in all non-test code.
Bulk of the changes were produced using
git grep -l ' ASSERT(' | grep -v test | grep -v 'common\.h' |\
xargs -n1 sed -i 's/ ASSERT(/ RTC_DCHECK(/'
followed by additional includes of base/checks.h in affected files,
and git cl format.
Also had to do some tweaks to #if !defined(NDEBUG) logic in the
taskrunner code (webrtc/base/task.cc, webrtc/base/taskparent.cc,
webrtc/base/taskparent.h, webrtc/base/taskrunner.cc), replaced to
consistently use RTC_DCHECK_IS_ON, and some of the checks needed
additional #if protection.
Test code was excluded, because it should probably use RTC_CHECK
rather than RTC_DCHECK.
BUG=webrtc:6424
Review-Url: https://codereview.webrtc.org/2620303003
Cr-Commit-Position: refs/heads/master@{#16030}
diff --git a/webrtc/base/win32.cc b/webrtc/base/win32.cc
index 182b84f..7dfff42 100644
--- a/webrtc/base/win32.cc
+++ b/webrtc/base/win32.cc
@@ -17,6 +17,7 @@
#include "webrtc/base/arraysize.h"
#include "webrtc/base/basictypes.h"
#include "webrtc/base/byteorder.h"
+#include "webrtc/base/checks.h"
#include "webrtc/base/common.h"
#include "webrtc/base/logging.h"
@@ -318,7 +319,7 @@
//
void FileTimeToUnixTime(const FILETIME& ft, time_t* ut) {
- ASSERT(NULL != ut);
+ RTC_DCHECK(NULL != ut);
// FILETIME has an earlier date base than time_t (1/1/1970), so subtract off
// the difference.
@@ -342,7 +343,7 @@
}
void UnixTimeToFileTime(const time_t& ut, FILETIME* ft) {
- ASSERT(NULL != ft);
+ RTC_DCHECK(NULL != ft);
// FILETIME has an earlier date base than time_t (1/1/1970), so add in
// the difference.
@@ -404,13 +405,13 @@
// Non-unc path: <pathname>
// Becomes: \\?\<pathname>
start -= 4;
- ASSERT(start >= full_filename);
+ RTC_DCHECK(start >= full_filename);
memcpy(start, kLongPathPrefix, 4 * sizeof(wchar_t));
} else if (start[2] != L'?') {
// Unc path: \\<server>\<pathname>
// Becomes: \\?\UNC\<server>\<pathname>
start -= 6;
- ASSERT(start >= full_filename);
+ RTC_DCHECK(start >= full_filename);
memcpy(start, kLongPathPrefix, 7 * sizeof(wchar_t));
} else {
// Already in long-path form.