aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/private/SkTDArray.h
diff options
context:
space:
mode:
authorGravatar Ben Wagner <bungeman@google.com>2017-08-28 10:34:05 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-08-28 17:48:57 +0000
commita93a14a99816d25b773f0b12868143702baf44bf (patch)
tree727e7cb88867bdc12cbcf8baa354ae3afc9444e2 /include/private/SkTDArray.h
parent695db408437807d049ecc02b3b852704092728f2 (diff)
Convert NULL and 0 to nullptr.
This was created by looking at warnings produced by clang's -Wzero-as-null-pointer-constant. This updates most issues in Skia code. However, there are places where GL and Vulkan want pointer values which are explicitly 0, external headers which use NULL directly, and possibly more uses in un-compiled sources (for other platforms). Change-Id: Id22fbac04d5c53497a53d734f0896b4f06fe8345 Reviewed-on: https://skia-review.googlesource.com/39521 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Ben Wagner <bungeman@google.com>
Diffstat (limited to 'include/private/SkTDArray.h')
-rw-r--r--include/private/SkTDArray.h24
1 files changed, 12 insertions, 12 deletions
diff --git a/include/private/SkTDArray.h b/include/private/SkTDArray.h
index 4c58d478fe..b0664aaa5b 100644
--- a/include/private/SkTDArray.h
+++ b/include/private/SkTDArray.h
@@ -20,7 +20,7 @@ public:
SkASSERT(src || count == 0);
fReserve = fCount = 0;
- fArray = NULL;
+ fArray = nullptr;
if (count) {
fArray = (T*)sk_malloc_throw(count * sizeof(T));
memcpy(fArray, src, sizeof(T) * count);
@@ -84,7 +84,7 @@ public:
*/
T* release() {
T* array = fArray;
- fArray = NULL;
+ fArray = nullptr;
fReserve = fCount = 0;
return array;
}
@@ -110,8 +110,8 @@ public:
T* begin() { return fArray; }
const T* begin() const { return fArray; }
- T* end() { return fArray ? fArray + fCount : NULL; }
- const T* end() const { return fArray ? fArray + fCount : NULL; }
+ T* end() { return fArray ? fArray + fCount : nullptr; }
+ const T* end() const { return fArray ? fArray + fCount : nullptr; }
T& operator[](int index) {
SkASSERT(index < fCount);
@@ -132,7 +132,7 @@ public:
void reset() {
if (fArray) {
sk_free(fArray);
- fArray = NULL;
+ fArray = nullptr;
fReserve = fCount = 0;
} else {
SkASSERT(fReserve == 0 && fCount == 0);
@@ -171,12 +171,12 @@ public:
}
T* append() {
- return this->append(1, NULL);
+ return this->append(1, nullptr);
}
- T* append(int count, const T* src = NULL) {
+ T* append(int count, const T* src = nullptr) {
int oldCount = fCount;
if (count) {
- SkASSERT(src == NULL || fArray == NULL ||
+ SkASSERT(src == nullptr || fArray == nullptr ||
src + count <= fArray || fArray + oldCount <= src);
this->adjustCount(count);
@@ -194,9 +194,9 @@ public:
}
T* insert(int index) {
- return this->insert(index, 1, NULL);
+ return this->insert(index, 1, nullptr);
}
- T* insert(int index, int count, const T* src = NULL) {
+ T* insert(int index, int count, const T* src = nullptr) {
SkASSERT(count);
SkASSERT(index <= fCount);
size_t oldCount = fCount;
@@ -345,8 +345,8 @@ public:
#ifdef SK_DEBUG
void validate() const {
- SkASSERT((fReserve == 0 && fArray == NULL) ||
- (fReserve > 0 && fArray != NULL));
+ SkASSERT((fReserve == 0 && fArray == nullptr) ||
+ (fReserve > 0 && fArray != nullptr));
SkASSERT(fCount <= fReserve);
}
#endif