Style Change: NULL->nullptr
DOCS_PREVIEW= https://skia.org/?cl=1316233002
Review URL: https://codereview.chromium.org/1316233002
diff --git a/src/codec/SkBmpCodec.cpp b/src/codec/SkBmpCodec.cpp
index b88c892..f2f6a8e 100644
--- a/src/codec/SkBmpCodec.cpp
+++ b/src/codec/SkBmpCodec.cpp
@@ -84,7 +84,7 @@
/*
* Read enough of the stream to initialize the SkBmpCodec. Returns a bool
* representing success or failure. If it returned true, and codecOut was
- * not NULL, it will be set to a new SkBmpCodec.
+ * not nullptr, it will be set to a new SkBmpCodec.
* Does *not* take ownership of the passed in SkStream.
*/
bool SkBmpCodec::ReadHeader(SkStream* stream, bool inIco, SkCodec** codecOut) {
@@ -441,7 +441,7 @@
// Check that input bit masks are valid and create the masks object
SkAutoTDelete<SkMasks>
masks(SkMasks::CreateMasks(inputMasks, bitsPerPixel));
- if (NULL == masks) {
+ if (nullptr == masks) {
SkCodecPrintf("Error: invalid input masks.\n");
return false;
}
@@ -514,7 +514,7 @@
*/
SkCodec* SkBmpCodec::NewFromStream(SkStream* stream, bool inIco) {
SkAutoTDelete<SkStream> streamDeleter(stream);
- SkCodec* codec = NULL;
+ SkCodec* codec = nullptr;
if (ReadHeader(stream, inIco, &codec)) {
// codec has taken ownership of stream, so we do not need to
// delete it.
@@ -522,7 +522,7 @@
streamDeleter.detach();
return codec;
}
- return NULL;
+ return nullptr;
}
SkBmpCodec::SkBmpCodec(const SkImageInfo& info, SkStream* stream,
@@ -533,7 +533,7 @@
{}
bool SkBmpCodec::onRewind() {
- return SkBmpCodec::ReadHeader(this->stream(), this->inIco(), NULL);
+ return SkBmpCodec::ReadHeader(this->stream(), this->inIco(), nullptr);
}
/*
diff --git a/src/codec/SkBmpCodec.h b/src/codec/SkBmpCodec.h
index 71006f7..ee14f89 100644
--- a/src/codec/SkBmpCodec.h
+++ b/src/codec/SkBmpCodec.h
@@ -58,7 +58,7 @@
/*
* Read enough of the stream to initialize the SkBmpCodec. Returns a bool
* representing success or failure. If it returned true, and codecOut was
- * not NULL, it will be set to a new SkBmpCodec.
+ * not nullptr, it will be set to a new SkBmpCodec.
* Does *not* take ownership of the passed in SkStream.
*/
static bool ReadHeader(SkStream*, bool inIco, SkCodec** codecOut);
diff --git a/src/codec/SkBmpMaskCodec.cpp b/src/codec/SkBmpMaskCodec.cpp
index 90457b2..5684b68 100644
--- a/src/codec/SkBmpMaskCodec.cpp
+++ b/src/codec/SkBmpMaskCodec.cpp
@@ -17,8 +17,8 @@
SkBmpCodec::RowOrder rowOrder)
: INHERITED(info, stream, bitsPerPixel, rowOrder)
, fMasks(masks)
- , fMaskSwizzler(NULL)
- , fSrcBuffer(NULL)
+ , fMaskSwizzler(nullptr)
+ , fSrcBuffer(nullptr)
{}
/*
@@ -64,7 +64,7 @@
fMaskSwizzler.reset(SkMaskSwizzler::CreateMaskSwizzler(
dstInfo, fMasks, this->bitsPerPixel()));
- if (NULL == fMaskSwizzler.get()) {
+ if (nullptr == fMaskSwizzler.get()) {
return false;
}
@@ -94,7 +94,7 @@
if (kNo_ZeroInitialized == opts.fZeroInitialized || 0 != fillColor) {
void* dstStart = this->getDstStartRow(dst, dstRowBytes, y);
SkSwizzler::Fill(dstStart, dstInfo, dstRowBytes, dstInfo.height() - y, fillColor,
- NULL);
+ nullptr);
}
return kIncompleteInput;
}
diff --git a/src/codec/SkBmpRLECodec.cpp b/src/codec/SkBmpRLECodec.cpp
index ed0617f..9af19d1 100644
--- a/src/codec/SkBmpRLECodec.cpp
+++ b/src/codec/SkBmpRLECodec.cpp
@@ -24,7 +24,7 @@
SkBmpCodec::RowOrder rowOrder,
size_t RLEBytes)
: INHERITED(info, stream, bitsPerPixel, rowOrder)
- , fColorTable(NULL)
+ , fColorTable(nullptr)
, fNumColors(this->computeNumColors(numColors))
, fBytesPerColor(bytesPerColor)
, fOffset(offset)
@@ -57,7 +57,7 @@
}
// Create the color table if necessary and prepare the stream for decode
- // Note that if it is non-NULL, inputColorCount will be modified
+ // Note that if it is non-nullptr, inputColorCount will be modified
if (!this->createColorTable(inputColorCount)) {
SkCodecPrintf("Error: could not create color table.\n");
return kInvalidInput;
@@ -86,7 +86,7 @@
if (this->bitsPerPixel() <= 8) {
// Inform the caller of the number of colors
uint32_t maxColors = 1 << this->bitsPerPixel();
- if (NULL != numColors) {
+ if (nullptr != numColors) {
// We set the number of colors to maxColors in order to ensure
// safe memory accesses. Otherwise, an invalid pixel could
// access memory outside of our color table array.
@@ -291,7 +291,7 @@
// type that makes sense for the destination format.
SkASSERT(kN32_SkColorType == dstInfo.colorType());
if (kNo_ZeroInitialized == opts.fZeroInitialized) {
- SkSwizzler::Fill(dst, dstInfo, dstRowBytes, height, SK_ColorTRANSPARENT, NULL);
+ SkSwizzler::Fill(dst, dstInfo, dstRowBytes, height, SK_ColorTRANSPARENT, nullptr);
}
while (true) {
diff --git a/src/codec/SkBmpRLECodec.h b/src/codec/SkBmpRLECodec.h
index ee8989b..65b0180 100644
--- a/src/codec/SkBmpRLECodec.h
+++ b/src/codec/SkBmpRLECodec.h
@@ -49,7 +49,7 @@
/*
* Creates the color table
- * Sets colorCount to the new color count if it is non-NULL
+ * Sets colorCount to the new color count if it is non-nullptr
*/
bool createColorTable(int* colorCount);
diff --git a/src/codec/SkBmpStandardCodec.cpp b/src/codec/SkBmpStandardCodec.cpp
index 8404aa6..210498e 100644
--- a/src/codec/SkBmpStandardCodec.cpp
+++ b/src/codec/SkBmpStandardCodec.cpp
@@ -20,12 +20,12 @@
uint32_t bytesPerColor, uint32_t offset,
SkBmpCodec::RowOrder rowOrder, bool inIco)
: INHERITED(info, stream, bitsPerPixel, rowOrder)
- , fColorTable(NULL)
+ , fColorTable(nullptr)
, fNumColors(this->computeNumColors(numColors))
, fBytesPerColor(bytesPerColor)
, fOffset(offset)
- , fSwizzler(NULL)
- , fSrcBuffer(NULL)
+ , fSwizzler(nullptr)
+ , fSrcBuffer(nullptr)
, fInIco(inIco)
{}
@@ -54,7 +54,7 @@
}
// Create the color table if necessary and prepare the stream for decode
- // Note that if it is non-NULL, inputColorCount will be modified
+ // Note that if it is non-nullptr, inputColorCount will be modified
if (!this->createColorTable(dstInfo.alphaType(), inputColorCount)) {
SkCodecPrintf("Error: could not create color table.\n");
return kInvalidInput;
@@ -82,7 +82,7 @@
if (this->bitsPerPixel() <= 8) {
// Inform the caller of the number of colors
uint32_t maxColors = 1 << this->bitsPerPixel();
- if (NULL != numColors) {
+ if (nullptr != numColors) {
// We set the number of colors to maxColors in order to ensure
// safe memory accesses. Otherwise, an invalid pixel could
// access memory outside of our color table array.
@@ -112,7 +112,7 @@
// should fail if the alpha type is not one of the above
// values.
SkASSERT(false);
- packARGB = NULL;
+ packARGB = nullptr;
break;
}
@@ -210,7 +210,7 @@
fSwizzler.reset(SkSwizzler::CreateSwizzler(config,
colorPtr, dstInfo, opts.fZeroInitialized, this->getInfo()));
- if (NULL == fSwizzler.get()) {
+ if (nullptr == fSwizzler.get()) {
return false;
}
return true;
diff --git a/src/codec/SkBmpStandardCodec.h b/src/codec/SkBmpStandardCodec.h
index 45450e6..a7d48c8 100644
--- a/src/codec/SkBmpStandardCodec.h
+++ b/src/codec/SkBmpStandardCodec.h
@@ -52,7 +52,7 @@
/*
* Creates the color table
- * Sets colorCount to the new color count if it is non-NULL
+ * Sets colorCount to the new color count if it is non-nullptr
*/
bool createColorTable(SkAlphaType alphaType, int* colorCount);
diff --git a/src/codec/SkCodec.cpp b/src/codec/SkCodec.cpp
index 76abcda..d12de21 100644
--- a/src/codec/SkCodec.cpp
+++ b/src/codec/SkCodec.cpp
@@ -38,17 +38,17 @@
SkCodec* SkCodec::NewFromStream(SkStream* stream) {
if (!stream) {
- return NULL;
+ return nullptr;
}
SkAutoTDelete<SkStream> streamDeleter(stream);
- SkAutoTDelete<SkCodec> codec(NULL);
+ SkAutoTDelete<SkCodec> codec(nullptr);
for (uint32_t i = 0; i < SK_ARRAY_COUNT(gDecoderProcs); i++) {
DecoderProc proc = gDecoderProcs[i];
const bool correctFormat = proc.IsFormat(stream);
if (!stream->rewind()) {
- return NULL;
+ return nullptr;
}
if (correctFormat) {
codec.reset(proc.NewFromStream(streamDeleter.detach()));
@@ -62,7 +62,7 @@
const int32_t maxSize = 1 << 27;
if (codec && codec->getInfo().width() * codec->getInfo().height() > maxSize) {
SkCodecPrintf("Error: Image size too large, cannot decode.\n");
- return NULL;
+ return nullptr;
} else {
return codec.detach();
}
@@ -70,7 +70,7 @@
SkCodec* SkCodec::NewFromData(SkData* data) {
if (!data) {
- return NULL;
+ return nullptr;
}
return NewFromStream(new SkMemoryStream(data));
}
@@ -104,7 +104,7 @@
if (kUnknown_SkColorType == info.colorType()) {
return kInvalidConversion;
}
- if (NULL == pixels) {
+ if (nullptr == pixels) {
return kInvalidParameters;
}
if (rowBytes < info.minRowBytes()) {
@@ -112,15 +112,15 @@
}
if (kIndex_8_SkColorType == info.colorType()) {
- if (NULL == ctable || NULL == ctableCount) {
+ if (nullptr == ctable || nullptr == ctableCount) {
return kInvalidParameters;
}
} else {
if (ctableCount) {
*ctableCount = 0;
}
- ctableCount = NULL;
- ctable = NULL;
+ ctableCount = nullptr;
+ ctable = nullptr;
}
{
@@ -134,7 +134,7 @@
// Default options.
Options optsStorage;
- if (NULL == options) {
+ if (nullptr == options) {
options = &optsStorage;
}
const Result result = this->onGetPixels(info, pixels, rowBytes, *options, ctable, ctableCount);
@@ -146,5 +146,5 @@
}
SkCodec::Result SkCodec::getPixels(const SkImageInfo& info, void* pixels, size_t rowBytes) {
- return this->getPixels(info, pixels, rowBytes, NULL, NULL, NULL);
+ return this->getPixels(info, pixels, rowBytes, nullptr, nullptr, nullptr);
}
diff --git a/src/codec/SkCodecPriv.h b/src/codec/SkCodecPriv.h
index 450457f..9a28cfd 100644
--- a/src/codec/SkCodecPriv.h
+++ b/src/codec/SkCodecPriv.h
@@ -82,10 +82,10 @@
}
/*
- * If there is a color table, get a pointer to the colors, otherwise return NULL
+ * If there is a color table, get a pointer to the colors, otherwise return nullptr
*/
static const SkPMColor* get_color_ptr(SkColorTable* colorTable) {
- return NULL != colorTable ? colorTable->readColors() : NULL;
+ return nullptr != colorTable ? colorTable->readColors() : nullptr;
}
/*
@@ -95,9 +95,9 @@
static inline void copy_color_table(const SkImageInfo& dstInfo, SkColorTable* colorTable,
SkPMColor* inputColorPtr, int* inputColorCount) {
if (kIndex_8_SkColorType == dstInfo.colorType()) {
- SkASSERT(NULL != inputColorPtr);
- SkASSERT(NULL != inputColorCount);
- SkASSERT(NULL != colorTable);
+ SkASSERT(nullptr != inputColorPtr);
+ SkASSERT(nullptr != inputColorCount);
+ SkASSERT(nullptr != colorTable);
memcpy(inputColorPtr, colorTable->readColors(), *inputColorCount * 4);
}
}
diff --git a/src/codec/SkCodec_libgif.cpp b/src/codec/SkCodec_libgif.cpp
index 40d159a..250a0d6 100644
--- a/src/codec/SkCodec_libgif.cpp
+++ b/src/codec/SkCodec_libgif.cpp
@@ -59,7 +59,7 @@
* Open the gif file
*/
static GifFileType* open_gif(SkStream* stream) {
- return DGifOpen(stream, read_bytes_callback, NULL);
+ return DGifOpen(stream, read_bytes_callback, nullptr);
}
/*
@@ -67,7 +67,7 @@
* It is used in a SkAutoTCallIProc template
*/
void SkGifCodec::CloseGif(GifFileType* gif) {
- DGifCloseFile(gif, NULL);
+ DGifCloseFile(gif, nullptr);
}
/*
@@ -75,7 +75,7 @@
* decoder
*/
void SkGifCodec::FreeExtension(SavedImage* image) {
- if (NULL != image->ExtensionBlocks) {
+ if (nullptr != image->ExtensionBlocks) {
GifFreeExtensions(&image->ExtensionBlockCount, &image->ExtensionBlocks);
}
}
@@ -123,12 +123,12 @@
* Returns a bool representing success or failure.
*
* @param codecOut
- * If it returned true, and codecOut was not NULL,
+ * If it returned true, and codecOut was not nullptr,
* codecOut will be set to a new SkGifCodec.
*
* @param gifOut
- * If it returned true, and codecOut was NULL,
- * gifOut must be non-NULL and gifOut will be set to a new
+ * If it returned true, and codecOut was nullptr,
+ * gifOut must be non-nullptr and gifOut will be set to a new
* GifFileType pointer.
*
* @param stream
@@ -143,12 +143,12 @@
// Read gif header, logical screen descriptor, and global color table
SkAutoTCallVProc<GifFileType, CloseGif> gif(open_gif(stream));
- if (NULL == gif) {
+ if (nullptr == gif) {
gif_error("DGifOpen failed.\n");
return false;
}
- if (NULL != codecOut) {
+ if (nullptr != codecOut) {
// Get fields from header
const int32_t width = gif->SWidth;
const int32_t height = gif->SHeight;
@@ -172,7 +172,7 @@
kIndex_8_SkColorType, kPremul_SkAlphaType);
*codecOut = new SkGifCodec(imageInfo, streamDeleter.detach(), gif.detach());
} else {
- SkASSERT(NULL != gifOut);
+ SkASSERT(nullptr != gifOut);
streamDeleter.detach();
*gifOut = gif.detach();
}
@@ -185,11 +185,11 @@
* Reads enough of the stream to determine the image format
*/
SkCodec* SkGifCodec::NewFromStream(SkStream* stream) {
- SkCodec* codec = NULL;
- if (ReadHeader(stream, &codec, NULL)) {
+ SkCodec* codec = nullptr;
+ if (ReadHeader(stream, &codec, nullptr)) {
return codec;
}
- return NULL;
+ return nullptr;
}
SkGifCodec::SkGifCodec(const SkImageInfo& srcInfo, SkStream* stream,
@@ -199,12 +199,12 @@
{}
bool SkGifCodec::onRewind() {
- GifFileType* gifOut = NULL;
- if (!ReadHeader(this->stream(), NULL, &gifOut)) {
+ GifFileType* gifOut = nullptr;
+ if (!ReadHeader(this->stream(), nullptr, &gifOut)) {
return false;
}
- SkASSERT(NULL != gifOut);
+ SkASSERT(nullptr != gifOut);
fGif.reset(gifOut);
return true;
}
@@ -239,7 +239,7 @@
// blocks. This generally stores transparency and animation instructions.
SavedImage saveExt;
SkAutoTCallVProc<SavedImage, FreeExtension> autoFreeExt(&saveExt);
- saveExt.ExtensionBlocks = NULL;
+ saveExt.ExtensionBlocks = nullptr;
saveExt.ExtensionBlockCount = 0;
GifByteType* extData;
int32_t extFunction;
@@ -309,8 +309,8 @@
SkPMColor* colorTable;
SkColorType dstColorType = dstInfo.colorType();
if (kIndex_8_SkColorType == dstColorType) {
- SkASSERT(NULL != inputColorPtr);
- SkASSERT(NULL != inputColorCount);
+ SkASSERT(nullptr != inputColorPtr);
+ SkASSERT(nullptr != inputColorCount);
colorTable = inputColorPtr;
} else {
colorTable = alternateColorPtr;
@@ -322,10 +322,10 @@
const uint32_t maxColors = 256;
ColorMapObject* colorMap = fGif->Image.ColorMap;
// If there is no local color table, use the global color table
- if (NULL == colorMap) {
+ if (nullptr == colorMap) {
colorMap = fGif->SColorMap;
}
- if (NULL != colorMap) {
+ if (nullptr != colorMap) {
colorCount = colorMap->ColorCount;
SkASSERT(colorCount ==
(unsigned) (1 << (colorMap->BitsPerPixel)));
@@ -380,7 +380,7 @@
}
// Check if image is only a subset of the image frame
- SkAutoTDelete<SkSwizzler> swizzler(NULL);
+ SkAutoTDelete<SkSwizzler> swizzler(nullptr);
if (innerWidth < width || innerHeight < height) {
// Modify the destination info
@@ -497,7 +497,7 @@
}
// Create an extension block with our data
- while (NULL != extData) {
+ while (nullptr != extData) {
// Add a single block
if (GIF_ERROR ==
GifAddExtensionBlock(&saveExt.ExtensionBlockCount,
diff --git a/src/codec/SkCodec_libgif.h b/src/codec/SkCodec_libgif.h
index 109020b..df01088 100644
--- a/src/codec/SkCodec_libgif.h
+++ b/src/codec/SkCodec_libgif.h
@@ -38,12 +38,12 @@
* Returns a bool representing success or failure.
*
* @param codecOut
- * If it returned true, and codecOut was not NULL,
+ * If it returned true, and codecOut was not nullptr,
* codecOut will be set to a new SkGifCodec.
*
* @param gifOut
- * If it returned true, and codecOut was NULL,
- * gifOut must be non-NULL and gifOut will be set to a new
+ * If it returned true, and codecOut was nullptr,
+ * gifOut must be non-nullptr and gifOut will be set to a new
* GifFileType pointer.
*
* @param stream
diff --git a/src/codec/SkCodec_libico.cpp b/src/codec/SkCodec_libico.cpp
index e8e6531..6f34336 100644
--- a/src/codec/SkCodec_libico.cpp
+++ b/src/codec/SkCodec_libico.cpp
@@ -45,14 +45,14 @@
if (inputStream.get()->read(dirBuffer.get(), kIcoDirectoryBytes) !=
kIcoDirectoryBytes) {
SkCodecPrintf("Error: unable to read ico directory header.\n");
- return NULL;
+ return nullptr;
}
// Process the directory header
const uint16_t numImages = get_short(dirBuffer.get(), 4);
if (0 == numImages) {
SkCodecPrintf("Error: No images embedded in ico.\n");
- return NULL;
+ return nullptr;
}
// Ensure that we can read all of indicated directory entries
@@ -60,7 +60,7 @@
if (inputStream.get()->read(entryBuffer.get(), numImages*kIcoDirEntryBytes) !=
numImages*kIcoDirEntryBytes) {
SkCodecPrintf("Error: unable to read ico directory entries.\n");
- return NULL;
+ return nullptr;
}
// This structure is used to represent the vital information about entries
@@ -131,7 +131,7 @@
// Create a new stream for the embedded codec
SkAutoTUnref<SkData> data(
SkData::NewFromStream(inputStream.get(), size));
- if (NULL == data.get()) {
+ if (nullptr == data.get()) {
SkCodecPrintf("Warning: could not create embedded stream.\n");
break;
}
@@ -141,7 +141,7 @@
// Check if the embedded codec is bmp or png and create the codec
const bool isPng = SkPngCodec::IsPng(embeddedStream);
SkAssertResult(embeddedStream->rewind());
- SkCodec* codec = NULL;
+ SkCodec* codec = nullptr;
if (isPng) {
codec = SkPngCodec::NewFromStream(embeddedStream.detach());
} else {
@@ -149,7 +149,7 @@
}
// Save a valid codec
- if (NULL != codec) {
+ if (nullptr != codec) {
codecs->push_back().reset(codec);
}
}
@@ -157,7 +157,7 @@
// Recognize if there are no valid codecs
if (0 == codecs->count()) {
SkCodecPrintf("Error: could not find any valid embedded ico codecs.\n");
- return NULL;
+ return nullptr;
}
// Use the largest codec as a "suggestion" for image info
@@ -195,7 +195,7 @@
*/
SkIcoCodec::SkIcoCodec(const SkImageInfo& info,
SkTArray<SkAutoTDelete<SkCodec>, true>* codecs)
- : INHERITED(info, NULL)
+ : INHERITED(info, nullptr)
, fEmbeddedCodecs(codecs)
{}
diff --git a/src/codec/SkCodec_libpng.cpp b/src/codec/SkCodec_libpng.cpp
index 31a4d2e..2e54342 100644
--- a/src/codec/SkCodec_libpng.cpp
+++ b/src/codec/SkCodec_libpng.cpp
@@ -27,19 +27,19 @@
/* These were dropped in libpng >= 1.4 */
#ifndef png_infopp_NULL
- #define png_infopp_NULL NULL
+ #define png_infopp_NULL nullptr
#endif
#ifndef png_bytepp_NULL
- #define png_bytepp_NULL NULL
+ #define png_bytepp_NULL nullptr
#endif
#ifndef int_p_NULL
- #define int_p_NULL NULL
+ #define int_p_NULL nullptr
#endif
#ifndef png_flush_ptr_NULL
- #define png_flush_ptr_NULL NULL
+ #define png_flush_ptr_NULL nullptr
#endif
///////////////////////////////////////////////////////////////////////////////
@@ -75,24 +75,24 @@
public:
AutoCleanPng(png_structp png_ptr)
: fPng_ptr(png_ptr)
- , fInfo_ptr(NULL) {}
+ , fInfo_ptr(nullptr) {}
~AutoCleanPng() {
- // fInfo_ptr will never be non-NULL unless fPng_ptr is.
+ // fInfo_ptr will never be non-nullptr unless fPng_ptr is.
if (fPng_ptr) {
- png_infopp info_pp = fInfo_ptr ? &fInfo_ptr : NULL;
+ png_infopp info_pp = fInfo_ptr ? &fInfo_ptr : nullptr;
png_destroy_read_struct(&fPng_ptr, info_pp, png_infopp_NULL);
}
}
void setInfoPtr(png_infop info_ptr) {
- SkASSERT(NULL == fInfo_ptr);
+ SkASSERT(nullptr == fInfo_ptr);
fInfo_ptr = info_ptr;
}
void detach() {
- fPng_ptr = NULL;
- fInfo_ptr = NULL;
+ fPng_ptr = nullptr;
+ fInfo_ptr = nullptr;
}
private:
@@ -111,7 +111,7 @@
png_bytep trans;
int num_trans;
- png_get_tRNS(png_ptr, info_ptr, &trans, &num_trans, NULL);
+ png_get_tRNS(png_ptr, info_ptr, &trans, &num_trans, nullptr);
return num_trans > 0;
}
@@ -136,7 +136,7 @@
int numTrans;
if (png_get_valid(fPng_ptr, fInfo_ptr, PNG_INFO_tRNS)) {
- png_get_tRNS(fPng_ptr, fInfo_ptr, &trans, &numTrans, NULL);
+ png_get_tRNS(fPng_ptr, fInfo_ptr, &trans, &numTrans, nullptr);
} else {
numTrans = 0;
}
@@ -185,7 +185,7 @@
}
// Set the new color count
- if (ctableCount != NULL) {
+ if (ctableCount != nullptr) {
*ctableCount = colorCount;
}
@@ -210,7 +210,7 @@
return true;
}
-// Reads the header, and initializes the passed in fields, if not NULL (except
+// Reads the header, and initializes the passed in fields, if not nullptr (except
// stream, which is passed to the read function).
// Returns true on success, in which case the caller is responsible for calling
// png_destroy_read_struct. If it returns false, the passed in fields (except
@@ -218,7 +218,7 @@
static bool read_header(SkStream* stream, png_structp* png_ptrp,
png_infop* info_ptrp, SkImageInfo* imageInfo, int* bitDepthPtr) {
// The image is known to be a PNG. Decode enough to know the SkImageInfo.
- png_structp png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL,
+ png_structp png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, nullptr,
sk_error_fn, sk_warning_fn);
if (!png_ptr) {
return false;
@@ -227,7 +227,7 @@
AutoCleanPng autoClean(png_ptr);
png_infop info_ptr = png_create_info_struct(png_ptr);
- if (info_ptr == NULL) {
+ if (info_ptr == nullptr) {
return false;
}
@@ -358,7 +358,7 @@
if (read_header(stream, &png_ptr, &info_ptr, &imageInfo, &bitDepth)) {
return new SkPngCodec(imageInfo, streamDeleter.detach(), png_ptr, info_ptr, bitDepth);
}
- return NULL;
+ return nullptr;
}
#define INVALID_NUMBER_PASSES -1
@@ -379,11 +379,11 @@
void SkPngCodec::destroyReadStruct() {
if (fPng_ptr) {
- // We will never have a NULL fInfo_ptr with a non-NULL fPng_ptr
+ // We will never have a nullptr fInfo_ptr with a non-nullptr fPng_ptr
SkASSERT(fInfo_ptr);
png_destroy_read_struct(&fPng_ptr, &fInfo_ptr, png_infopp_NULL);
- fPng_ptr = NULL;
- fInfo_ptr = NULL;
+ fPng_ptr = nullptr;
+ fInfo_ptr = nullptr;
}
}
@@ -450,16 +450,16 @@
bool SkPngCodec::onRewind() {
- // This sets fPng_ptr and fInfo_ptr to NULL. If read_header
+ // This sets fPng_ptr and fInfo_ptr to nullptr. If read_header
// succeeds, they will be repopulated, and if it fails, they will
- // remain NULL. Any future accesses to fPng_ptr and fInfo_ptr will
+ // remain nullptr. Any future accesses to fPng_ptr and fInfo_ptr will
// come through this function which will rewind and again attempt
// to reinitialize them.
this->destroyReadStruct();
png_structp png_ptr;
png_infop info_ptr;
- if (!read_header(this->stream(), &png_ptr, &info_ptr, NULL, NULL)) {
+ if (!read_header(this->stream(), &png_ptr, &info_ptr, nullptr, nullptr)) {
return false;
}
@@ -771,7 +771,7 @@
SkScanlineDecoder* SkPngCodec::NewSDFromStream(SkStream* stream) {
SkAutoTDelete<SkPngCodec> codec (static_cast<SkPngCodec*>(SkPngCodec::NewFromStream(stream)));
if (!codec) {
- return NULL;
+ return nullptr;
}
codec->fNumberPasses = png_set_interlace_handling(codec->fPng_ptr);
diff --git a/src/codec/SkCodec_wbmp.cpp b/src/codec/SkCodec_wbmp.cpp
index 16cdbea..22f2bac 100644
--- a/src/codec/SkCodec_wbmp.cpp
+++ b/src/codec/SkCodec_wbmp.cpp
@@ -68,7 +68,7 @@
}
bool SkWbmpCodec::onRewind() {
- return read_header(this->stream(), NULL);
+ return read_header(this->stream(), nullptr);
}
SkSwizzler* SkWbmpCodec::initializeSwizzler(const SkImageInfo& info,
@@ -82,7 +82,7 @@
return SkSwizzler::CreateSwizzler(SkSwizzler::kBit, ctable, info, opts.fZeroInitialized,
this->getInfo());
default:
- return NULL;
+ return nullptr;
}
}
@@ -129,7 +129,7 @@
// Initialize the swizzler
SkAutoTDelete<SkSwizzler> swizzler(this->initializeSwizzler(info, ctable, options));
- if (NULL == swizzler.get()) {
+ if (nullptr == swizzler.get()) {
return kInvalidConversion;
}
@@ -149,14 +149,14 @@
}
bool SkWbmpCodec::IsWbmp(SkStream* stream) {
- return read_header(stream, NULL);
+ return read_header(stream, nullptr);
}
SkCodec* SkWbmpCodec::NewFromStream(SkStream* stream) {
SkAutoTDelete<SkStream> streamDeleter(stream);
SkISize size;
if (!read_header(stream, &size)) {
- return NULL;
+ return nullptr;
}
SkImageInfo info = SkImageInfo::Make(size.width(), size.height(),
kGray_8_SkColorType, kOpaque_SkAlphaType);
@@ -171,8 +171,8 @@
SkWbmpScanlineDecoder(SkWbmpCodec* codec)
: INHERITED(codec->getInfo())
, fCodec(codec)
- , fColorTable(NULL)
- , fSwizzler(NULL)
+ , fColorTable(nullptr)
+ , fSwizzler(nullptr)
, fSrcBuffer(codec->fSrcRowBytes)
{}
@@ -220,7 +220,7 @@
// Initialize the swizzler
fSwizzler.reset(fCodec->initializeSwizzler(dstInfo,
get_color_ptr(fColorTable.get()), options));
- if (NULL == fSwizzler.get()) {
+ if (nullptr == fSwizzler.get()) {
return SkCodec::kInvalidConversion;
}
@@ -244,7 +244,7 @@
SkAutoTDelete<SkWbmpCodec> codec(static_cast<SkWbmpCodec*>(
SkWbmpCodec::NewFromStream(stream)));
if (!codec) {
- return NULL;
+ return nullptr;
}
// Return the new scanline decoder
diff --git a/src/codec/SkCodec_wbmp.h b/src/codec/SkCodec_wbmp.h
index 8c54661..0891eb8 100644
--- a/src/codec/SkCodec_wbmp.h
+++ b/src/codec/SkCodec_wbmp.h
@@ -36,7 +36,7 @@
bool onRewind() override;
private:
/*
- * Returns a swizzler on success, NULL on failure
+ * Returns a swizzler on success, nullptr on failure
*/
SkSwizzler* initializeSwizzler(const SkImageInfo& info, const SkPMColor* ctable,
const Options& opts);
diff --git a/src/codec/SkGifInterlaceIter.cpp b/src/codec/SkGifInterlaceIter.cpp
index 268a142e..3a87f695 100644
--- a/src/codec/SkGifInterlaceIter.cpp
+++ b/src/codec/SkGifInterlaceIter.cpp
@@ -28,8 +28,8 @@
SK_ARRAY_COUNT(kStartingInterlaceYValues) == fStartYPtr) {
// Now we have iterated over the entire image. Forbid any
// subsequent calls to nextY().
- SkDEBUGCODE(fStartYPtr = NULL;)
- SkDEBUGCODE(fDeltaYPtr = NULL;)
+ SkDEBUGCODE(fStartYPtr = nullptr;)
+ SkDEBUGCODE(fDeltaYPtr = nullptr;)
y = 0;
} else {
y = *fStartYPtr++;
diff --git a/src/codec/SkJpegCodec.cpp b/src/codec/SkJpegCodec.cpp
index 4988dca..ed3944c 100644
--- a/src/codec/SkJpegCodec.cpp
+++ b/src/codec/SkJpegCodec.cpp
@@ -116,7 +116,7 @@
return decoderMgr->returnFalse("read_header");
}
- if (NULL != codecOut) {
+ if (nullptr != codecOut) {
// Recommend the color type to decode to
const SkColorType colorType = decoderMgr->getColorType();
@@ -125,7 +125,7 @@
decoderMgr->dinfo()->image_height, colorType, kOpaque_SkAlphaType);
*codecOut = new SkJpegCodec(imageInfo, stream, decoderMgr.detach());
} else {
- SkASSERT(NULL != decoderMgrOut);
+ SkASSERT(nullptr != decoderMgrOut);
*decoderMgrOut = decoderMgr.detach();
}
return true;
@@ -133,14 +133,14 @@
SkCodec* SkJpegCodec::NewFromStream(SkStream* stream) {
SkAutoTDelete<SkStream> streamDeleter(stream);
- SkCodec* codec = NULL;
- if (ReadHeader(stream, &codec, NULL)) {
+ SkCodec* codec = nullptr;
+ if (ReadHeader(stream, &codec, nullptr)) {
// Codec has taken ownership of the stream, we do not need to delete it
SkASSERT(codec);
streamDeleter.detach();
return codec;
}
- return NULL;
+ return nullptr;
}
SkJpegCodec::SkJpegCodec(const SkImageInfo& srcInfo, SkStream* stream,
@@ -199,11 +199,11 @@
}
bool SkJpegCodec::onRewind() {
- JpegDecoderMgr* decoderMgr = NULL;
- if (!ReadHeader(this->stream(), NULL, &decoderMgr)) {
+ JpegDecoderMgr* decoderMgr = nullptr;
+ if (!ReadHeader(this->stream(), nullptr, &decoderMgr)) {
return fDecoderMgr->returnFalse("could not rewind");
}
- SkASSERT(NULL != decoderMgr);
+ SkASSERT(nullptr != decoderMgr);
fDecoderMgr.reset(decoderMgr);
return true;
}
@@ -358,7 +358,7 @@
if (kNo_ZeroInitialized == options.fZeroInitialized ||
kN32_SkColorType == dstInfo.colorType()) {
SkSwizzler::Fill(dstRow, dstInfo, dstRowBytes, dstHeight - y,
- SK_ColorBLACK, NULL);
+ SK_ColorBLACK, nullptr);
}
// Prevent libjpeg from failing on incomplete decode
@@ -425,7 +425,7 @@
SkASSERT(false);
}
- fSwizzler.reset(SkSwizzler::CreateSwizzler(srcConfig, NULL, info, options.fZeroInitialized,
+ fSwizzler.reset(SkSwizzler::CreateSwizzler(srcConfig, nullptr, info, options.fZeroInitialized,
this->getInfo()));
if (!fSwizzler) {
// FIXME: CreateSwizzler could fail for another reason.
@@ -469,8 +469,8 @@
fStorage.reset(get_row_bytes(fCodec->fDecoderMgr->dinfo()));
fSrcRow = static_cast<uint8_t*>(fStorage.get());
} else {
- fSrcRow = NULL;
- fSwizzler.reset(NULL);
+ fSrcRow = nullptr;
+ fSwizzler.reset(nullptr);
}
// Now, given valid output dimensions, we can start the decompress
@@ -519,7 +519,7 @@
if (SkCodec::kNo_ZeroInitialized == fOpts.fZeroInitialized ||
kN32_SkColorType == this->dstInfo().colorType()) {
SkSwizzler::Fill(dstRow, this->dstInfo(), rowBytes,
- count - y, SK_ColorBLACK, NULL);
+ count - y, SK_ColorBLACK, nullptr);
}
fCodec->fDecoderMgr->dinfo()->output_scanline = this->dstInfo().height();
return SkCodec::kIncompleteInput;
@@ -580,7 +580,7 @@
SkScanlineDecoder* SkJpegCodec::NewSDFromStream(SkStream* stream) {
SkAutoTDelete<SkJpegCodec> codec(static_cast<SkJpegCodec*>(SkJpegCodec::NewFromStream(stream)));
if (!codec) {
- return NULL;
+ return nullptr;
}
const SkImageInfo& srcInfo = codec->getInfo();
diff --git a/src/codec/SkJpegCodec.h b/src/codec/SkJpegCodec.h
index fac7d96..ce4fe56 100644
--- a/src/codec/SkJpegCodec.h
+++ b/src/codec/SkJpegCodec.h
@@ -74,12 +74,12 @@
* Returns a bool representing success or failure.
*
* @param codecOut
- * If this returns true, and codecOut was not NULL,
+ * If this returns true, and codecOut was not nullptr,
* codecOut will be set to a new SkJpegCodec.
*
* @param decoderMgrOut
- * If this returns true, and codecOut was NULL,
- * decoderMgrOut must be non-NULL and decoderMgrOut will be set to a new
+ * If this returns true, and codecOut was nullptr,
+ * decoderMgrOut must be non-nullptr and decoderMgrOut will be set to a new
* JpegDecoderMgr pointer.
*
* @param stream
diff --git a/src/codec/SkMaskSwizzler.cpp b/src/codec/SkMaskSwizzler.cpp
index 95f3627..58be0c6 100644
--- a/src/codec/SkMaskSwizzler.cpp
+++ b/src/codec/SkMaskSwizzler.cpp
@@ -225,7 +225,7 @@
const SkImageInfo& info, SkMasks* masks, uint32_t bitsPerPixel) {
// Choose the appropriate row procedure
- RowProc proc = NULL;
+ RowProc proc = nullptr;
switch (bitsPerPixel) {
case 16:
switch (info.colorType()) {
@@ -319,7 +319,7 @@
break;
default:
SkASSERT(false);
- return NULL;
+ return nullptr;
}
return new SkMaskSwizzler(info, masks, proc);
}
@@ -342,6 +342,6 @@
*
*/
SkSwizzler::ResultAlpha SkMaskSwizzler::swizzle(void* dst, const uint8_t* SK_RESTRICT src) {
- SkASSERT(NULL != dst && NULL != src);
+ SkASSERT(nullptr != dst && nullptr != src);
return fRowProc(dst, src, fDstInfo.width(), fMasks);
}
diff --git a/src/codec/SkMasks.cpp b/src/codec/SkMasks.cpp
index b136c59..b860314 100644
--- a/src/codec/SkMasks.cpp
+++ b/src/codec/SkMasks.cpp
@@ -139,7 +139,7 @@
if (((masks.red & masks.green) | (masks.red & masks.blue) |
(masks.red & masks.alpha) | (masks.green & masks.blue) |
(masks.green & masks.alpha) | (masks.blue & masks.alpha)) != 0) {
- return NULL;
+ return nullptr;
}
// Collect information about the masks
diff --git a/src/codec/SkScaledCodec.cpp b/src/codec/SkScaledCodec.cpp
index bf09b4b..7ff279c 100644
--- a/src/codec/SkScaledCodec.cpp
+++ b/src/codec/SkScaledCodec.cpp
@@ -14,7 +14,7 @@
SkCodec* SkScaledCodec::NewFromStream(SkStream* stream) {
bool isWebp = SkWebpCodec::IsWebp(stream);
if (!stream->rewind()) {
- return NULL;
+ return nullptr;
}
if (isWebp) {
// Webp codec supports scaling and subsetting natively
@@ -22,8 +22,8 @@
}
SkAutoTDelete<SkScanlineDecoder> scanlineDecoder(SkScanlineDecoder::NewFromStream(stream));
- if (NULL == scanlineDecoder) {
- return NULL;
+ if (nullptr == scanlineDecoder) {
+ return nullptr;
}
// wrap in new SkScaledCodec
@@ -32,13 +32,13 @@
SkCodec* SkScaledCodec::NewFromData(SkData* data) {
if (!data) {
- return NULL;
+ return nullptr;
}
return NewFromStream(new SkMemoryStream(data));
}
SkScaledCodec::SkScaledCodec(SkScanlineDecoder* scanlineDecoder)
- : INHERITED(scanlineDecoder->getInfo(), NULL)
+ : INHERITED(scanlineDecoder->getInfo(), nullptr)
, fScanlineDecoder(scanlineDecoder)
{}
diff --git a/src/codec/SkScanlineDecoder.cpp b/src/codec/SkScanlineDecoder.cpp
index 5c94a6d..859956f 100644
--- a/src/codec/SkScanlineDecoder.cpp
+++ b/src/codec/SkScanlineDecoder.cpp
@@ -28,17 +28,17 @@
SkScanlineDecoder* SkScanlineDecoder::NewFromStream(SkStream* stream) {
if (!stream) {
- return NULL;
+ return nullptr;
}
SkAutoTDelete<SkStream> streamDeleter(stream);
- SkAutoTDelete<SkScanlineDecoder> codec(NULL);
+ SkAutoTDelete<SkScanlineDecoder> codec(nullptr);
for (uint32_t i = 0; i < SK_ARRAY_COUNT(gDecoderProcs); i++) {
DecoderProc proc = gDecoderProcs[i];
const bool correctFormat = proc.IsFormat(stream);
if (!stream->rewind()) {
- return NULL;
+ return nullptr;
}
if (correctFormat) {
codec.reset(proc.NewFromStream(streamDeleter.detach()));
@@ -52,7 +52,7 @@
const int32_t maxSize = 1 << 27;
if (codec && codec->getInfo().width() * codec->getInfo().height() > maxSize) {
SkCodecPrintf("Error: Image size too large, cannot decode.\n");
- return NULL;
+ return nullptr;
} else {
return codec.detach();
}
@@ -60,7 +60,7 @@
SkScanlineDecoder* SkScanlineDecoder::NewFromData(SkData* data) {
if (!data) {
- return NULL;
+ return nullptr;
}
return NewFromStream(new SkMemoryStream(data));
}
@@ -70,20 +70,20 @@
const SkCodec::Options* options, SkPMColor ctable[], int* ctableCount) {
// Ensure that valid color ptrs are passed in for kIndex8 color type
if (kIndex_8_SkColorType == dstInfo.colorType()) {
- if (NULL == ctable || NULL == ctableCount) {
+ if (nullptr == ctable || nullptr == ctableCount) {
return SkCodec::kInvalidParameters;
}
} else {
if (ctableCount) {
*ctableCount = 0;
}
- ctableCount = NULL;
- ctable = NULL;
+ ctableCount = nullptr;
+ ctable = nullptr;
}
// Set options.
SkCodec::Options optsStorage;
- if (NULL == options) {
+ if (nullptr == options) {
options = &optsStorage;
}
@@ -98,6 +98,6 @@
}
SkCodec::Result SkScanlineDecoder::start(const SkImageInfo& dstInfo) {
- return this->start(dstInfo, NULL, NULL, NULL);
+ return this->start(dstInfo, nullptr, nullptr, nullptr);
}
diff --git a/src/codec/SkSwizzler.cpp b/src/codec/SkSwizzler.cpp
index db49fb1..54d9764 100644
--- a/src/codec/SkSwizzler.cpp
+++ b/src/codec/SkSwizzler.cpp
@@ -517,13 +517,13 @@
SkCodec::ZeroInitialized zeroInit,
const SkImageInfo& srcInfo) {
if (dstInfo.colorType() == kUnknown_SkColorType || kUnknown == sc) {
- return NULL;
+ return nullptr;
}
if ((kIndex == sc || kIndex4 == sc || kIndex2 == sc || kIndex1 == sc)
- && NULL == ctable) {
- return NULL;
+ && nullptr == ctable) {
+ return nullptr;
}
- RowProc proc = NULL;
+ RowProc proc = nullptr;
switch (sc) {
case kBit:
@@ -679,8 +679,8 @@
default:
break;
}
- if (NULL == proc) {
- return NULL;
+ if (nullptr == proc) {
+ return nullptr;
}
// Store deltaSrc in bytes if it is an even multiple, otherwise use bits
@@ -688,7 +688,7 @@
// get sampleX based on srcInfo and dstInfo dimensions
int sampleX;
- SkScaledCodec::ComputeSampleSize(dstInfo, srcInfo, &sampleX, NULL);
+ SkScaledCodec::ComputeSampleSize(dstInfo, srcInfo, &sampleX, nullptr);
return new SkSwizzler(proc, ctable, deltaSrc, dstInfo, sampleX);
}
@@ -707,13 +707,13 @@
}
SkSwizzler::ResultAlpha SkSwizzler::swizzle(void* dst, const uint8_t* SK_RESTRICT src) {
- SkASSERT(NULL != dst && NULL != src);
+ SkASSERT(nullptr != dst && nullptr != src);
return fRowProc(dst, src, fDstInfo.width(), fSampleX * fDeltaSrc, fX0 * fDeltaSrc, fColorTable);
}
void SkSwizzler::Fill(void* dstStartRow, const SkImageInfo& dstInfo, size_t dstRowBytes,
uint32_t numRows, uint32_t colorOrIndex, const SkPMColor* colorTable) {
- SkASSERT(dstStartRow != NULL);
+ SkASSERT(dstStartRow != nullptr);
SkASSERT(numRows <= (uint32_t) dstInfo.height());
// Calculate bytes to fill. We use getSafeSize since the last row may not be padded.
@@ -724,7 +724,7 @@
case kN32_SkColorType:
// Assume input is an index if we have a color table
uint32_t color;
- if (NULL != colorTable) {
+ if (nullptr != colorTable) {
SkASSERT(colorOrIndex == (uint8_t) colorOrIndex);
color = colorTable[colorOrIndex];
// Otherwise, assume the input is a color
diff --git a/src/codec/SkSwizzler.h b/src/codec/SkSwizzler.h
index b7132ce..3d57205 100644
--- a/src/codec/SkSwizzler.h
+++ b/src/codec/SkSwizzler.h
@@ -128,7 +128,7 @@
Sampling in Y can be done by a client with a scanline decoder,
but sampling in X allows the swizzler to skip swizzling pixels and
reading from and writing to memory.
- * @return A new SkSwizzler or NULL on failure.
+ * @return A new SkSwizzler or nullptr on failure.
*/
static SkSwizzler* CreateSwizzler(SrcConfig, const SkPMColor* ctable,
const SkImageInfo& dstInfo, SkCodec::ZeroInitialized,
@@ -149,13 +149,13 @@
* index.
*
* If dstInfo.colorType() is kN32, colorOrIndex is treated differently depending on
- * whether colorTable is NULL:
+ * whether colorTable is nullptr:
*
- * A NULL colorTable means colorOrIndex is treated as an SkPMColor (premul or
+ * A nullptr colorTable means colorOrIndex is treated as an SkPMColor (premul or
* unpremul, depending on dstInfo.alphaType()). Each 4-byte pixel will be set to
* colorOrIndex.
- * A non-NULL colorTable means colorOrIndex is treated as a uint8_t index into
+ * A non-nullptr colorTable means colorOrIndex is treated as a uint8_t index into
* the colorTable. i.e. each 4-byte pixel will be set to
* colorTable[(uint8_t) colorOrIndex].
*
diff --git a/src/codec/SkWebpCodec.cpp b/src/codec/SkWebpCodec.cpp
index e17aa7e..ccf4964 100644
--- a/src/codec/SkWebpCodec.cpp
+++ b/src/codec/SkWebpCodec.cpp
@@ -79,7 +79,7 @@
if (webp_parse_header(stream, &info)) {
return new SkWebpCodec(info, streamDeleter.detach());
}
- return NULL;
+ return nullptr;
}
// This version is slightly different from SkCodecPriv's version of conversion_possible. It
@@ -221,7 +221,7 @@
config.output.u.RGBA.size = dstInfo.getSafeSize(rowBytes);
config.output.is_external_memory = 1;
- SkAutoTCallVProc<WebPIDecoder, WebPIDelete> idec(WebPIDecode(NULL, 0, &config));
+ SkAutoTCallVProc<WebPIDecoder, WebPIDelete> idec(WebPIDecode(nullptr, 0, &config));
if (!idec) {
return kInvalidInput;
}