From: Stepan Palamarchuk Date: Thu, 7 Dec 2017 15:43:57 +0000 (-0800) Subject: Fix DCHECKs in IOBufQueue X-Git-Tag: v2017.12.11.00~14 X-Git-Url: http://plrg.eecs.uci.edu/git/?p=folly.git;a=commitdiff_plain;h=fd0b3090840d742492793fe306185550f0300283 Fix DCHECKs in IOBufQueue Summary: glog actually tries to pull srtings from these pointers when the checks fail, which obfuscates the error Reviewed By: yfeldblum Differential Revision: D6506886 fbshipit-source-id: 0283e02aecaa248b84fca1433d3f29f92c37b2e6 --- diff --git a/folly/io/IOBufQueue.h b/folly/io/IOBufQueue.h index 5c627bc9..97a690ee 100644 --- a/folly/io/IOBufQueue.h +++ b/folly/io/IOBufQueue.h @@ -236,7 +236,8 @@ class IOBufQueue { void dcheckIntegrity() { // Tail start should always be less than tail end. - DCHECK_LE(data_.cachedRange.first, data_.cachedRange.second); + DCHECK_LE( + (void*)data_.cachedRange.first, (void*)data_.cachedRange.second); DCHECK( data_.cachedRange.first != nullptr || data_.cachedRange.second == nullptr); @@ -376,7 +377,9 @@ class IOBufQueue { */ void postallocate(uint64_t n) { dcheckCacheIntegrity(); - DCHECK_LE(cachePtr_->cachedRange.first + n, cachePtr_->cachedRange.second); + DCHECK_LE( + (void*)(cachePtr_->cachedRange.first + n), + (void*)cachePtr_->cachedRange.second); cachePtr_->cachedRange.first += n; } @@ -553,8 +556,10 @@ class IOBufQueue { void dcheckCacheIntegrity() const { // Tail start should always be less than tail end. - DCHECK_LE(tailStart_, cachePtr_->cachedRange.first); - DCHECK_LE(cachePtr_->cachedRange.first, cachePtr_->cachedRange.second); + DCHECK_LE((void*)tailStart_, (void*)cachePtr_->cachedRange.first); + DCHECK_LE( + (void*)cachePtr_->cachedRange.first, + (void*)cachePtr_->cachedRange.second); DCHECK( cachePtr_->cachedRange.first != nullptr || cachePtr_->cachedRange.second == nullptr); @@ -606,7 +611,8 @@ class IOBufQueue { if (tailStart_ != cachePtr_->cachedRange.first) { auto buf = head_->prev(); DCHECK_EQ( - buf->writableTail() + buf->tailroom(), cachePtr_->cachedRange.second); + (void*)(buf->writableTail() + buf->tailroom()), + (void*)cachePtr_->cachedRange.second); auto len = cachePtr_->cachedRange.first - tailStart_; buf->append(len); chainLength_ += len;