From b530ef5869c5c64af8f3b3c62ed7711fe4325c9c Mon Sep 17 00:00:00 2001 From: "reed@google.com" Date: Wed, 20 Jul 2011 19:55:42 +0000 Subject: [PATCH] have == always return bool, never int git-svn-id: http://skia.googlecode.com/svn/trunk@1915 2bbb7eff-a529-9590-31e7-b0007b416f81 --- include/core/SkPaint.h | 4 ++-- include/core/SkRect.h | 6 +++--- include/core/SkString.h | 10 +++++----- include/core/SkTDArray.h | 2 +- src/core/SkPaint.cpp | 4 ++-- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/include/core/SkPaint.h b/include/core/SkPaint.h index 4e83651927..4cc75f7005 100644 --- a/include/core/SkPaint.h +++ b/include/core/SkPaint.h @@ -56,8 +56,8 @@ public: SkPaint& operator=(const SkPaint&); - SK_API friend int operator==(const SkPaint& a, const SkPaint& b); - friend int operator!=(const SkPaint& a, const SkPaint& b) { + SK_API friend bool operator==(const SkPaint& a, const SkPaint& b); + friend bool operator!=(const SkPaint& a, const SkPaint& b) { return !(a == b); } diff --git a/include/core/SkRect.h b/include/core/SkRect.h index 19ee12a596..e57130a458 100644 --- a/include/core/SkRect.h +++ b/include/core/SkRect.h @@ -71,12 +71,12 @@ struct SK_API SkIRect { */ int height() const { return fBottom - fTop; } - friend int operator==(const SkIRect& a, const SkIRect& b) { + friend bool operator==(const SkIRect& a, const SkIRect& b) { return !memcmp(&a, &b, sizeof(a)); } - friend int operator!=(const SkIRect& a, const SkIRect& b) { - return memcmp(&a, &b, sizeof(a)); + friend bool operator!=(const SkIRect& a, const SkIRect& b) { + return !(a == b); } bool is16Bit() const { diff --git a/include/core/SkString.h b/include/core/SkString.h index abfdd24ca5..cb2ea5d809 100644 --- a/include/core/SkString.h +++ b/include/core/SkString.h @@ -89,19 +89,19 @@ public: return SkStrEndsWith(fRec->data(), suffix); } - friend int operator==(const SkString& a, const SkString& b) { + friend bool operator==(const SkString& a, const SkString& b) { return a.equals(b); } - friend int operator!=(const SkString& a, const SkString& b) { + friend bool operator!=(const SkString& a, const SkString& b) { return !a.equals(b); } // these methods edit the string - SkString& operator=(const SkString&); - SkString& operator=(const char text[]); + SkString& operator=(const SkString&); + SkString& operator=(const char text[]); - char* writable_str(); + char* writable_str(); char& operator[](size_t n) { return this->writable_str()[n]; } void reset(); diff --git a/include/core/SkTDArray.h b/include/core/SkTDArray.h index c64d773b07..d5795634c3 100644 --- a/include/core/SkTDArray.h +++ b/include/core/SkTDArray.h @@ -71,7 +71,7 @@ public: return *this; } - friend int operator==(const SkTDArray& a, const SkTDArray& b) { + friend bool operator==(const SkTDArray& a, const SkTDArray& b) { return a.fCount == b.fCount && (a.fCount == 0 || !memcmp(a.fArray, b.fArray, a.fCount * sizeof(T))); diff --git a/src/core/SkPaint.cpp b/src/core/SkPaint.cpp index dbb8ecaad8..d39a65044a 100644 --- a/src/core/SkPaint.cpp +++ b/src/core/SkPaint.cpp @@ -138,8 +138,8 @@ SkPaint& SkPaint::operator=(const SkPaint& src) { return *this; } -int operator==(const SkPaint& a, const SkPaint& b) { - return memcmp(&a, &b, sizeof(a)) == 0; +bool operator==(const SkPaint& a, const SkPaint& b) { + return !memcmp(&a, &b, sizeof(a)); } void SkPaint::reset() { -- 2.34.1