From b89a643b6992d478c0b8bda3abc53f37a87dbd22 Mon Sep 17 00:00:00 2001 From: "reed@google.com" Date: Mon, 7 Feb 2011 13:20:30 +0000 Subject: [PATCH] fix warning about size_t >= 0 (which must always be true) git-svn-id: http://skia.googlecode.com/svn/trunk@760 2bbb7eff-a529-9590-31e7-b0007b416f81 --- gpu/src/GrTextureCache.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/gpu/src/GrTextureCache.cpp b/gpu/src/GrTextureCache.cpp index bc2a9043e..e27272ec2 100644 --- a/gpu/src/GrTextureCache.cpp +++ b/gpu/src/GrTextureCache.cpp @@ -274,17 +274,19 @@ static int countMatches(const GrTextureEntry* head, const GrTextureEntry* target return count; } +#if GR_DEBUG +static bool both_zero_or_nonzero(int count, size_t bytes) { + return (count == 0 && bytes == 0) || (count > 0 && bytes > 0); +} +#endif + void GrTextureCache::validate() const { GrAssert(!fHead == !fTail); - GrAssert(!fEntryCount == !fEntryBytes); - GrAssert(!fClientDetachedBytes == !fClientDetachedBytes); + GrAssert(both_zero_or_nonzero(fEntryCount, fEntryBytes)); + GrAssert(both_zero_or_nonzero(fClientDetachedCount, fClientDetachedBytes)); GrAssert(fClientDetachedBytes <= fEntryBytes); GrAssert(fClientDetachedCount <= fEntryCount); GrAssert((fEntryCount - fClientDetachedCount) == fCache.count()); - GrAssert(fEntryBytes >= 0); - GrAssert(fEntryCount >= 0); - GrAssert(fClientDetachedCount >= 0); - GrAssert(fClientDetachedBytes >= 0); fCache.validate();