"NULL !=" = NULL
R=reed@google.com
Author: bsalomon@google.com
Review URL: https://codereview.chromium.org/544233002
diff --git a/tools/PictureBenchmark.cpp b/tools/PictureBenchmark.cpp
index 8a714ca..15b6173 100644
--- a/tools/PictureBenchmark.cpp
+++ b/tools/PictureBenchmark.cpp
@@ -73,7 +73,7 @@
fRenderer->setup();
if (fPreprocess) {
- if (NULL != fRenderer->getCanvas()) {
+ if (fRenderer->getCanvas()) {
fRenderer->getCanvas()->EXPERIMENTAL_optimize(fRenderer->getPicture());
}
}
diff --git a/tools/PictureRenderer.cpp b/tools/PictureRenderer.cpp
index b2bac00..8148a2b 100644
--- a/tools/PictureRenderer.cpp
+++ b/tools/PictureRenderer.cpp
@@ -60,7 +60,7 @@
SkASSERT(NULL == fPicture);
SkASSERT(NULL == fCanvas.get());
- if (NULL != fPicture || NULL != fCanvas.get()) {
+ if (fPicture || fCanvas.get()) {
return;
}
@@ -74,7 +74,7 @@
}
void PictureRenderer::CopyString(SkString* dest, const SkString* src) {
- if (NULL != src) {
+ if (src) {
dest->set(*src);
} else {
dest->reset();
@@ -90,7 +90,7 @@
paint->setFlags(paint->getFlags() & ~fFlags[t] & SkPaint::kAllFlags);
if (PictureRenderer::kMaskFilter_DrawFilterFlag & fFlags[t]) {
SkMaskFilter* maskFilter = paint->getMaskFilter();
- if (NULL != maskFilter) {
+ if (maskFilter) {
paint->setMaskFilter(NULL);
}
}
@@ -212,8 +212,8 @@
* should call this method during init.
*/
void PictureRenderer::buildBBoxHierarchy() {
- SkASSERT(NULL != fPicture);
- if (kNone_BBoxHierarchyType != fBBoxHierarchyType && NULL != fPicture) {
+ SkASSERT(fPicture);
+ if (kNone_BBoxHierarchyType != fBBoxHierarchyType && fPicture) {
SkAutoTDelete<SkBBHFactory> factory(this->getFactory());
SkPictureRecorder recorder;
SkCanvas* canvas = recorder.beginRecording(fPicture->cullRect().width(),
@@ -305,14 +305,14 @@
outputFilename.appendU64(imageDigestPtr->getHashValue());
} else {
outputFilename.set(escapedInputFilename);
- if (NULL != tileNumberPtr) {
+ if (tileNumberPtr) {
outputFilename.append("-tile");
outputFilename.appendS32(*tileNumberPtr);
}
}
outputFilename.append(".png");
- if (NULL != jsonSummaryPtr) {
+ if (jsonSummaryPtr) {
ImageDigest *imageDigestPtr = bitmapAndDigest.getImageDigestPtr();
SkString outputRelativePath;
if (outputSubdirPtr) {
@@ -392,7 +392,7 @@
pipeCanvas->drawPicture(fPicture);
writer.endRecording();
fCanvas->flush();
- if (NULL != out) {
+ if (out) {
*out = SkNEW(SkBitmap);
setup_bitmap(*out, SkScalarCeilToInt(fPicture->cullRect().width()),
SkScalarCeilToInt(fPicture->cullRect().height()));
@@ -421,14 +421,14 @@
bool SimplePictureRenderer::render(SkBitmap** out) {
SkASSERT(fCanvas.get() != NULL);
- SkASSERT(NULL != fPicture);
+ SkASSERT(fPicture);
if (NULL == fCanvas.get() || NULL == fPicture) {
return false;
}
fCanvas->drawPicture(fPicture);
fCanvas->flush();
- if (NULL != out) {
+ if (out) {
*out = SkNEW(SkBitmap);
setup_bitmap(*out, SkScalarCeilToInt(fPicture->cullRect().width()),
SkScalarCeilToInt(fPicture->cullRect().height()));
@@ -467,7 +467,7 @@
void TiledPictureRenderer::init(const SkPicture* pict, const SkString* writePath,
const SkString* mismatchPath, const SkString* inputFilename,
bool useChecksumBasedFilenames) {
- SkASSERT(NULL != pict);
+ SkASSERT(pict);
SkASSERT(0 == fTileRects.count());
if (NULL == pict || fTileRects.count() != 0) {
return;
@@ -662,7 +662,7 @@
success &= write(fCanvas, fWritePath, fMismatchPath, fInputFilename, fJsonSummaryPtr,
fUseChecksumBasedFilenames, &i);
}
- if (NULL != out) {
+ if (out) {
if (fCanvas->readPixels(&bitmap, 0, 0)) {
// Add this tile to the entire bitmap.
bitmapCopyAtOffset(bitmap, *out, SkScalarFloorToInt(fTileRects[i].left()),
@@ -677,7 +677,7 @@
SkCanvas* TiledPictureRenderer::setupCanvas(int width, int height) {
SkCanvas* canvas = this->INHERITED::setupCanvas(width, height);
- SkASSERT(NULL != fPicture);
+ SkASSERT(fPicture);
// Clip the tile to an area that is completely inside both the SkPicture and the viewport. This
// is mostly important for tiles on the right and bottom edges as they may go over this area and
// the picture may have some commands that draw outside of this area and so should not actually
diff --git a/tools/filtermain.cpp b/tools/filtermain.cpp
index 00854d4..87d68ff 100644
--- a/tools/filtermain.cpp
+++ b/tools/filtermain.cpp
@@ -84,7 +84,7 @@
const SkPaint* saveLayerPaint = saveLayer->paint();
// if (NULL == saveLayerPaint) the dbmr's paint doesn't need to be changed
- if (NULL != saveLayerPaint) {
+ if (saveLayerPaint) {
SkDrawBitmapRectCommand* dbmr =
(SkDrawBitmapRectCommand*) canvas->getDrawCommandAt(curCommand+1);
SkPaint* dbmrPaint = dbmr->paint();
@@ -92,7 +92,7 @@
if (NULL == dbmrPaint) {
// if the DBMR doesn't have a paint just use the saveLayer's
dbmr->setPaint(*saveLayerPaint);
- } else if (NULL != saveLayerPaint) {
+ } else if (saveLayerPaint) {
// Both paints are present so their alphas need to be combined
SkColor color = saveLayerPaint->getColor();
int a0 = SkColorGetA(color);
@@ -162,7 +162,7 @@
const SkPaint* saveLayerPaint = saveLayer->paint();
// if (NULL == saveLayerPaint) the dbmr's paint doesn't need to be changed
- if (NULL != saveLayerPaint) {
+ if (saveLayerPaint) {
SkDrawBitmapRectCommand* dbmr =
(SkDrawBitmapRectCommand*) canvas->getDrawCommandAt(curCommand+3);
SkPaint* dbmrPaint = dbmr->paint();
@@ -423,8 +423,8 @@
const SkPaint* saveLayerPaint0 = saveLayer0->paint();
const SkPaint* saveLayerPaint1 = saveLayer1->paint();
- if ((NULL != saveLayerPaint0 && !is_simple(*saveLayerPaint0)) ||
- (NULL != saveLayerPaint1 && !is_simple(*saveLayerPaint1))) {
+ if ((saveLayerPaint0 && !is_simple(*saveLayerPaint0)) ||
+ (saveLayerPaint1 && !is_simple(*saveLayerPaint1))) {
return false;
}
@@ -434,14 +434,14 @@
return true;
}
- if (NULL != saveLayerPaint0) {
+ if (saveLayerPaint0) {
SkColor layerColor0 = saveLayerPaint0->getColor() | 0xFF000000; // force opaque
if (dbmrPaint->getColor() != layerColor0) {
return false;
}
}
- if (NULL != saveLayerPaint1) {
+ if (saveLayerPaint1) {
SkColor layerColor1 = saveLayerPaint1->getColor() | 0xFF000000; // force opaque
if (dbmrPaint->getColor() != layerColor1) {
return false;
@@ -477,7 +477,7 @@
int a0, a1;
const SkPaint* saveLayerPaint0 = saveLayer0->paint();
- if (NULL != saveLayerPaint0) {
+ if (saveLayerPaint0) {
color = saveLayerPaint0->getColor();
a0 = SkColorGetA(color);
} else {
@@ -485,7 +485,7 @@
}
const SkPaint* saveLayerPaint1 = saveLayer1->paint();
- if (NULL != saveLayerPaint1) {
+ if (saveLayerPaint1) {
color = saveLayerPaint1->getColor();
a1 = SkColorGetA(color);
} else {
@@ -497,7 +497,7 @@
SkPaint* dbmrPaint = dbmr->paint();
- if (NULL != dbmrPaint) {
+ if (dbmrPaint) {
SkColor newColor = SkColorSetA(dbmrPaint->getColor(), newA);
dbmrPaint->setColor(newColor);
} else {
@@ -579,7 +579,7 @@
SkScalar newSrcLeft, newSrcTop;
- if (NULL != dbmr->srcRect()) {
+ if (dbmr->srcRect()) {
newSrcLeft = dbmr->srcRect()->fLeft + clip->rect().fLeft - dbmr->dstRect().fLeft;
newSrcTop = dbmr->srcRect()->fTop + clip->rect().fTop - dbmr->dstRect().fTop;
} else {
diff --git a/tools/flags/SkCommandLineFlags.h b/tools/flags/SkCommandLineFlags.h
index c6a783d..0fb0233 100644
--- a/tools/flags/SkCommandLineFlags.h
+++ b/tools/flags/SkCommandLineFlags.h
@@ -416,7 +416,7 @@
, fStrings(NULL) {
fNext = SkCommandLineFlags::gHead;
SkCommandLineFlags::gHead = this;
- SkASSERT(NULL != name && strlen(name) > 1);
+ SkASSERT(name && strlen(name) > 1);
SkASSERT(NULL == shortName || 1 == strlen(shortName));
}
diff --git a/tools/picture_utils.cpp b/tools/picture_utils.cpp
index 6a35dd1..5c120b0 100644
--- a/tools/picture_utils.cpp
+++ b/tools/picture_utils.cpp
@@ -18,7 +18,7 @@
void force_all_opaque(const SkBitmap& bitmap) {
SkASSERT(NULL == bitmap.getTexture());
SkASSERT(kN32_SkColorType == bitmap.colorType());
- if (NULL != bitmap.getTexture() || kN32_SkColorType == bitmap.colorType()) {
+ if (bitmap.getTexture() || kN32_SkColorType == bitmap.colorType()) {
return;
}
diff --git a/tools/render_pictures_main.cpp b/tools/render_pictures_main.cpp
index 9ec136c..4fb8352 100644
--- a/tools/render_pictures_main.cpp
+++ b/tools/render_pictures_main.cpp
@@ -145,11 +145,11 @@
SkBitmap** out) {
SkString inputFilename = SkOSPath::Basename(inputPath.c_str());
SkString writePathString;
- if (NULL != writePath && writePath->size() > 0 && !FLAGS_writeEncodedImages) {
+ if (writePath && writePath->size() > 0 && !FLAGS_writeEncodedImages) {
writePathString.set(*writePath);
}
SkString mismatchPathString;
- if (NULL != mismatchPath && mismatchPath->size() > 0) {
+ if (mismatchPath && mismatchPath->size() > 0) {
mismatchPathString.set(*mismatchPath);
}
@@ -207,7 +207,7 @@
FLAGS_writeChecksumBasedFilenames);
if (FLAGS_preprocess) {
- if (NULL != renderer.getCanvas()) {
+ if (renderer.getCanvas()) {
renderer.getCanvas()->EXPERIMENTAL_optimize(renderer.getPicture());
}
}
@@ -250,7 +250,7 @@
}
~AutoRestoreBbhType() {
- if (NULL != fRenderer) {
+ if (fRenderer) {
fRenderer->setBBoxHierarchyType(fSavedBbhType);
}
}
@@ -369,17 +369,17 @@
sk_tools::replace_char(&outputFilename, '.', '_');
outputFilename.append(".png");
- if (NULL != jsonSummaryPtr) {
+ if (jsonSummaryPtr) {
sk_tools::ImageDigest imageDigest(*bitmap);
jsonSummaryPtr->add(inputFilename.c_str(), outputFilename.c_str(), imageDigest);
- if ((NULL != mismatchPath) && !mismatchPath->isEmpty() &&
+ if ((mismatchPath) && !mismatchPath->isEmpty() &&
!jsonSummaryPtr->getExpectation(inputFilename.c_str()).matches(imageDigest)) {
success &= sk_tools::write_bitmap_to_disk(*bitmap, *mismatchPath, NULL,
outputFilename);
}
}
- if ((NULL != writePath) && !writePath->isEmpty()) {
+ if ((writePath) && !writePath->isEmpty()) {
success &= sk_tools::write_bitmap_to_disk(*bitmap, *writePath, NULL, outputFilename);
}
}
diff --git a/tools/skdiff_image.cpp b/tools/skdiff_image.cpp
index 172f62b..89f7381 100644
--- a/tools/skdiff_image.cpp
+++ b/tools/skdiff_image.cpp
@@ -37,11 +37,11 @@
drp->fComparison.fStatus = DiffResource::kSpecified_Status;
SkAutoDataUnref baseFileBits(read_file(drp->fBase.fFullPath.c_str()));
- if (NULL != baseFileBits) {
+ if (baseFileBits) {
drp->fBase.fStatus = DiffResource::kRead_Status;
}
SkAutoDataUnref comparisonFileBits(read_file(drp->fComparison.fFullPath.c_str()));
- if (NULL != comparisonFileBits) {
+ if (comparisonFileBits) {
drp->fComparison.fStatus = DiffResource::kRead_Status;
}
if (NULL == baseFileBits || NULL == comparisonFileBits) {
diff --git a/tools/skdiff_main.cpp b/tools/skdiff_main.cpp
index ba322167..df07844 100644
--- a/tools/skdiff_main.cpp
+++ b/tools/skdiff_main.cpp
@@ -422,11 +422,11 @@
drp->fComparison.fStatus = DiffResource::kExists_Status;
SkAutoDataUnref baseFileBits(read_file(drp->fBase.fFullPath.c_str()));
- if (NULL != baseFileBits) {
+ if (baseFileBits) {
drp->fBase.fStatus = DiffResource::kRead_Status;
}
SkAutoDataUnref comparisonFileBits(read_file(drp->fComparison.fFullPath.c_str()));
- if (NULL != comparisonFileBits) {
+ if (comparisonFileBits) {
drp->fComparison.fStatus = DiffResource::kRead_Status;
}
if (NULL == baseFileBits || NULL == comparisonFileBits) {
diff --git a/tools/skdiff_utils.cpp b/tools/skdiff_utils.cpp
index 9157ac6..14a9fec 100644
--- a/tools/skdiff_utils.cpp
+++ b/tools/skdiff_utils.cpp
@@ -103,7 +103,7 @@
const char *first_char = input_cstr;
const char *match_char;
size_t oldSubstringLen = strlen(oldSubstring);
- while (NULL != (match_char = strstr(first_char, oldSubstring))) {
+ while ((match_char = strstr(first_char, oldSubstring))) {
output.append(first_char, (match_char - first_char));
output.append(newSubstring);
first_char = match_char + oldSubstringLen;
diff --git a/tools/skimage_main.cpp b/tools/skimage_main.cpp
index 60bdd05..a2d353c 100644
--- a/tools/skimage_main.cpp
+++ b/tools/skimage_main.cpp
@@ -511,7 +511,7 @@
const char* filename = basename.c_str();
if (!codec->decode(&stream, &bitmap, gPrefColorType, SkImageDecoder::kDecodePixels_Mode)) {
- if (NULL != gJsonExpectations.get()) {
+ if (gJsonExpectations.get()) {
const SkString name_config = create_json_key(filename);
skiagm::Expectations jsExpectations = gJsonExpectations->get(name_config.c_str());
if (jsExpectations.ignoreFailure()) {
@@ -637,7 +637,7 @@
}
if (SkImageDecoder::kUnknown_Format == format) {
const char* dot = strrchr(srcPath, '.');
- if (NULL != dot) {
+ if (dot) {
format = guess_format_from_suffix(dot);
}
if (SkImageDecoder::kUnknown_Format == format) {
diff --git a/tools/skpdiff/SkDiffContext.cpp b/tools/skpdiff/SkDiffContext.cpp
index 4248ca3..32688f5 100644
--- a/tools/skpdiff/SkDiffContext.cpp
+++ b/tools/skpdiff/SkDiffContext.cpp
@@ -27,7 +27,7 @@
}
SkDiffContext::~SkDiffContext() {
- if (NULL != fDiffers) {
+ if (fDiffers) {
SkDELETE_ARRAY(fDiffers);
}
}
@@ -56,7 +56,7 @@
void SkDiffContext::setDiffers(const SkTDArray<SkImageDiffer*>& differs) {
// Delete whatever the last array of differs was
- if (NULL != fDiffers) {
+ if (fDiffers) {
SkDELETE_ARRAY(fDiffers);
fDiffers = NULL;
fDifferCount = 0;
@@ -307,7 +307,7 @@
// See http://skbug.com/2713 ('make skpdiff use jsoncpp library to write out
// JSON output, instead of manual writeText() calls?')
stream.writeText(" \"records\": [\n");
- while (NULL != currentRecord) {
+ while (currentRecord) {
stream.writeText(" {\n");
SkString baselineAbsPath = get_absolute_path(currentRecord->fBaselinePath);
@@ -386,7 +386,7 @@
currentRecord = iter.next();
// JSON does not allow trailing commas
- if (NULL != currentRecord) {
+ if (currentRecord) {
stream.writeText(",");
}
stream.writeText("\n");
@@ -409,7 +409,7 @@
DiffRecord* currentRecord = iter.get();
// Write CSV header and create a dictionary of all columns.
- while (NULL != currentRecord) {
+ while (currentRecord) {
for (int diffIndex = 0; diffIndex < currentRecord->fDiffs.count(); diffIndex++) {
DiffData& data = currentRecord->fDiffs[diffIndex];
if (!columns.find(data.fDiffName)) {
@@ -428,7 +428,7 @@
SkTLList<DiffRecord>::Iter iter2(fRecords, SkTLList<DiffRecord>::Iter::kHead_IterStart);
currentRecord = iter2.get();
- while (NULL != currentRecord) {
+ while (currentRecord) {
for (int i = 0; i < cntColumns; i++) {
values[i] = -1;
}
diff --git a/tools/skpdiff/skpdiff_main.cpp b/tools/skpdiff/skpdiff_main.cpp
index 9c1f37f..c01767e 100644
--- a/tools/skpdiff/skpdiff_main.cpp
+++ b/tools/skpdiff/skpdiff_main.cpp
@@ -134,7 +134,7 @@
// Figure which differs the user chose, and optionally print them if the user requests it
SkTDArray<SkImageDiffer*> chosenDiffers;
- for (int differIndex = 0; NULL != gDiffers[differIndex]; differIndex++) {
+ for (int differIndex = 0; gDiffers[differIndex]; differIndex++) {
SkImageDiffer* differ = gDiffers[differIndex];
if (FLAGS_list) {
SkDebugf(" %s", differ->getName());
diff --git a/tools/skpdiff/skpdiff_util.cpp b/tools/skpdiff/skpdiff_util.cpp
index 4a92f5e..498f657 100644
--- a/tools/skpdiff/skpdiff_util.cpp
+++ b/tools/skpdiff/skpdiff_util.cpp
@@ -174,7 +174,7 @@
// Note these paths are in sorted order by default according to http://linux.die.net/man/3/glob
// Check under the flag GLOB_NOSORT
char** paths = globBuffer.gl_pathv;
- while(NULL != *paths) {
+ while(*paths) {
entries->push_back(SkString(*paths));
paths++;
}