Bug 784739 - Switch from NULL to nullptr in gfx/thebes/; r=ehsan

This commit is contained in:
Birunthan Mohanathas 2013-07-31 11:44:31 -04:00
parent 63b4981f64
commit 186d1e17e2
56 changed files with 330 additions and 314 deletions

View File

@ -113,7 +113,7 @@ gfxASurface*
gfxASurface::GetSurfaceWrapper(cairo_surface_t *csurf)
{
if (!csurf)
return NULL;
return nullptr;
return (gfxASurface*) cairo_surface_get_user_data(csurf, &gfxasurface_pointer_key);
}
@ -281,7 +281,7 @@ void *
gfxASurface::GetData(const cairo_user_data_key_t *key)
{
if (!mSurfaceValid)
return NULL;
return nullptr;
return cairo_surface_get_user_data(mSurface, key);
}

View File

@ -27,7 +27,7 @@ using namespace mozilla;
using namespace mozilla::dom;
using namespace mozilla::gfx;
static FT_Library gPlatformFTLibrary = NULL;
static FT_Library gPlatformFTLibrary = nullptr;
static int64_t sFreetypeMemoryUsed;
static FT_MemoryRec_ sFreetypeMemoryRecord;
@ -114,7 +114,7 @@ gfxAndroidPlatform::~gfxAndroidPlatform()
cairo_debug_reset_static_data();
FT_Done_Library(gPlatformFTLibrary);
gPlatformFTLibrary = NULL;
gPlatformFTLibrary = nullptr;
}
already_AddRefed<gfxASurface>

View File

@ -52,12 +52,13 @@ public:
* this value. This parameter should nearly always be computed using
* CalculateBlurRadius, below.
*
* @param aDirtyRect A pointer to a dirty rect, measured in device units, if available.
* This will be used for optimizing the blur operation. It is safe to pass NULL here.
* @param aDirtyRect A pointer to a dirty rect, measured in device units,
* if available. This will be used for optimizing the blur operation. It
* is safe to pass nullptr here.
*
* @param aSkipRect A pointer to a rect, measured in device units, that represents an area
* where blurring is unnecessary and shouldn't be done for speed reasons. It is safe to
* pass NULL here.
* @param aSkipRect A pointer to a rect, measured in device units, that
* represents an area where blurring is unnecessary and shouldn't be done
* for speed reasons. It is safe to pass nullptr here.
*/
gfxContext* Init(const gfxRect& aRect,
const gfxIntSize& aSpreadRadius,

View File

@ -36,7 +36,7 @@ using namespace mozilla::gfx;
class GeneralPattern
{
public:
GeneralPattern(gfxContext *aContext) : mContext(aContext), mPattern(NULL) {}
GeneralPattern(gfxContext *aContext) : mContext(aContext), mPattern(nullptr) {}
~GeneralPattern() { if (mPattern) { mPattern->~Pattern(); } }
operator mozilla::gfx::Pattern&()
@ -76,7 +76,7 @@ private:
};
gfxContext::gfxContext(gfxASurface *surface)
: mRefCairo(NULL)
: mRefCairo(nullptr)
, mSurface(surface)
{
MOZ_COUNT_CTOR(gfxContext);
@ -97,9 +97,9 @@ gfxContext::gfxContext(gfxASurface *surface)
gfxContext::gfxContext(DrawTarget *aTarget)
: mPathIsRect(false)
, mTransformChanged(false)
, mCairo(NULL)
, mRefCairo(NULL)
, mSurface(NULL)
, mCairo(nullptr)
, mRefCairo(nullptr)
, mSurface(nullptr)
, mFlags(0)
, mDT(aTarget)
, mOriginalDT(aTarget)
@ -224,8 +224,8 @@ gfxContext::NewPath()
if (mCairo) {
cairo_new_path(mCairo);
} else {
mPath = NULL;
mPathBuilder = NULL;
mPath = nullptr;
mPathBuilder = nullptr;
mPathIsRect = false;
mTransformChanged = false;
}
@ -934,7 +934,8 @@ gfxContext::SetDash(gfxFloat *dashes, int ndash, gfxFloat offset)
}
state.strokeOptions.mDashLength = ndash;
state.strokeOptions.mDashOffset = Float(offset);
state.strokeOptions.mDashPattern = ndash ? state.dashPattern.Elements() : NULL;
state.strokeOptions.mDashPattern = ndash ? state.dashPattern.Elements()
: nullptr;
}
}
@ -974,7 +975,7 @@ gfxContext::CurrentDashOffset() const
return 0.0;
}
gfxFloat offset;
cairo_get_dash(mCairo, NULL, &offset);
cairo_get_dash(mCairo, nullptr, &offset);
return offset;
} else {
return CurrentState().strokeOptions.mDashOffset;
@ -1122,7 +1123,7 @@ gfxContext::Clip(const gfxRect& rect)
cairo_rectangle(mCairo, rect.X(), rect.Y(), rect.Width(), rect.Height());
cairo_clip(mCairo);
} else {
AzureState::PushedClip clip = { NULL, ToRect(rect), mTransform };
AzureState::PushedClip clip = { nullptr, ToRect(rect), mTransform };
CurrentState().pushedClips.AppendElement(clip);
mDT->PushClipRect(ToRect(rect));
NewPath();
@ -1138,7 +1139,7 @@ gfxContext::Clip()
if (mPathIsRect) {
MOZ_ASSERT(!mTransformChanged);
AzureState::PushedClip clip = { NULL, mRect, mTransform };
AzureState::PushedClip clip = { nullptr, mRect, mTransform };
CurrentState().pushedClips.AppendElement(clip);
mDT->PushClipRect(mRect);
} else {
@ -1279,9 +1280,9 @@ gfxContext::SetColor(const gfxRGBA& c)
else
cairo_set_source_rgba(mCairo, c.r, c.g, c.b, c.a);
} else {
CurrentState().pattern = NULL;
CurrentState().sourceSurfCairo = NULL;
CurrentState().sourceSurface = NULL;
CurrentState().pattern = nullptr;
CurrentState().sourceSurfCairo = nullptr;
CurrentState().sourceSurface = nullptr;
if (gfxPlatform::GetCMSMode() == eCMSMode_All) {
@ -1305,9 +1306,9 @@ gfxContext::SetDeviceColor(const gfxRGBA& c)
if (mCairo) {
cairo_set_source_rgba(mCairo, c.r, c.g, c.b, c.a);
} else {
CurrentState().pattern = NULL;
CurrentState().sourceSurfCairo = NULL;
CurrentState().sourceSurface = NULL;
CurrentState().pattern = nullptr;
CurrentState().sourceSurfCairo = nullptr;
CurrentState().sourceSurface = nullptr;
CurrentState().color = ToColor(c);
}
}
@ -1343,7 +1344,7 @@ gfxContext::SetSource(gfxASurface *surface, const gfxPoint& offset)
cairo_set_source_surface(mCairo, surface->CairoSurface(), offset.x, offset.y);
} else {
CurrentState().surfTransform = Matrix(1.0f, 0, 0, 1.0f, Float(offset.x), Float(offset.y));
CurrentState().pattern = NULL;
CurrentState().pattern = nullptr;
CurrentState().patternTransformChanged = false;
// Keep the underlying cairo surface around while we keep the
// sourceSurface.
@ -1359,8 +1360,8 @@ gfxContext::SetPattern(gfxPattern *pattern)
if (mCairo) {
cairo_set_source(mCairo, pattern->CairoPattern());
} else {
CurrentState().sourceSurfCairo = NULL;
CurrentState().sourceSurface = NULL;
CurrentState().sourceSurfCairo = nullptr;
CurrentState().sourceSurface = nullptr;
CurrentState().patternTransformChanged = false;
CurrentState().pattern = pattern;
}
@ -1621,9 +1622,9 @@ gfxContext::PopGroupToSource()
RefPtr<SourceSurface> src = mDT->Snapshot();
Point deviceOffset = CurrentState().deviceOffset;
Restore();
CurrentState().sourceSurfCairo = NULL;
CurrentState().sourceSurfCairo = nullptr;
CurrentState().sourceSurface = src;
CurrentState().pattern = NULL;
CurrentState().pattern = nullptr;
CurrentState().patternTransformChanged = false;
Matrix mat = mTransform;
@ -1952,7 +1953,7 @@ gfxContext::EnsurePath()
{
if (mPathBuilder) {
mPath = mPathBuilder->Finish();
mPathBuilder = NULL;
mPathBuilder = nullptr;
}
if (mPath) {
@ -1962,7 +1963,7 @@ gfxContext::EnsurePath()
mat = mPathTransform * mat;
mPathBuilder = mPath->TransformedCopyToBuilder(mat, CurrentState().fillRule);
mPath = mPathBuilder->Finish();
mPathBuilder = NULL;
mPathBuilder = nullptr;
mTransformChanged = false;
}
@ -1974,13 +1975,13 @@ gfxContext::EnsurePath()
mPathBuilder = mPath->CopyToBuilder(CurrentState().fillRule);
mPath = mPathBuilder->Finish();
mPathBuilder = NULL;
mPathBuilder = nullptr;
return;
}
EnsurePathBuilder();
mPath = mPathBuilder->Finish();
mPathBuilder = NULL;
mPathBuilder = nullptr;
}
void
@ -1993,7 +1994,7 @@ gfxContext::EnsurePathBuilder()
if (mPath) {
if (!mTransformChanged) {
mPathBuilder = mPath->CopyToBuilder(CurrentState().fillRule);
mPath = NULL;
mPath = nullptr;
} else {
Matrix invTransform = mTransform;
invTransform.Invert();
@ -2019,8 +2020,8 @@ gfxContext::EnsurePathBuilder()
if (mTransformChanged) {
// This could be an else if since this should never happen when
// mPathBuilder is NULL and mPath is NULL. But this way we can assert
// if all the state is as expected.
// mPathBuilder is nullptr and mPath is nullptr. But this way we can
// assert if all the state is as expected.
MOZ_ASSERT(oldPath);
MOZ_ASSERT(!mPathIsRect);

View File

@ -67,7 +67,7 @@ public:
*/
already_AddRefed<gfxASurface> CurrentSurface(gfxFloat *dx, gfxFloat *dy);
already_AddRefed<gfxASurface> CurrentSurface() {
return CurrentSurface(NULL, NULL);
return CurrentSurface(nullptr, nullptr);
}
/**
@ -453,7 +453,7 @@ public:
void SetDash(gfxLineType ltype);
void SetDash(gfxFloat *dashes, int ndash, gfxFloat offset);
// Return true if dashing is set, false if it's not enabled or the
// context is in an error state. |offset| can be NULL to mean
// context is in an error state. |offset| can be nullptr to mean
// "don't care".
bool CurrentDash(FallibleTArray<gfxFloat>& dashes, gfxFloat* offset) const;
// Returns 0.0 if dashing isn't enabled.

View File

@ -32,8 +32,8 @@
using namespace mozilla;
// standard font descriptors that we construct the first time they're needed
CTFontDescriptorRef gfxCoreTextShaper::sDefaultFeaturesDescriptor = NULL;
CTFontDescriptorRef gfxCoreTextShaper::sDisableLigaturesDescriptor = NULL;
CTFontDescriptorRef gfxCoreTextShaper::sDefaultFeaturesDescriptor = nullptr;
CTFontDescriptorRef gfxCoreTextShaper::sDisableLigaturesDescriptor = nullptr;
gfxCoreTextShaper::gfxCoreTextShaper(gfxMacFont *aFont)
: gfxFontShaper(aFont)
@ -41,7 +41,7 @@ gfxCoreTextShaper::gfxCoreTextShaper(gfxMacFont *aFont)
// Create our CTFontRef
mCTFont = ::CTFontCreateWithGraphicsFont(aFont->GetCGFontRef(),
aFont->GetAdjustedSize(),
NULL,
nullptr,
GetDefaultFeaturesDescriptor());
// Set up the default attribute dictionary that we will need each time we create a CFAttributedString
@ -214,9 +214,9 @@ gfxCoreTextShaper::SetGlyphsFromRun(gfxShapedText *aShapedText,
nsAutoArrayPtr<CGGlyph> glyphsArray;
nsAutoArrayPtr<CGPoint> positionsArray;
nsAutoArrayPtr<CFIndex> glyphToCharArray;
const CGGlyph* glyphs = NULL;
const CGPoint* positions = NULL;
const CFIndex* glyphToChar = NULL;
const CGGlyph* glyphs = nullptr;
const CGPoint* positions = nullptr;
const CFIndex* glyphToChar = nullptr;
// Testing indicates that CTRunGetGlyphsPtr (almost?) always succeeds,
// and so allocating a new array and copying data with CTRunGetGlyphs
@ -260,7 +260,7 @@ gfxCoreTextShaper::SetGlyphsFromRun(gfxShapedText *aShapedText,
}
double runWidth = ::CTRunGetTypographicBounds(aCTRun, ::CFRangeMake(0, 0),
NULL, NULL, NULL);
nullptr, nullptr, nullptr);
nsAutoTArray<gfxShapedText::DetailedGlyph,1> detailedGlyphs;
gfxShapedText::CompressedGlyph g;
@ -513,7 +513,7 @@ gfxCoreTextShaper::SetGlyphsFromRun(gfxShapedText *aShapedText,
void
gfxCoreTextShaper::CreateDefaultFeaturesDescriptor()
{
if (sDefaultFeaturesDescriptor != NULL) {
if (sDefaultFeaturesDescriptor != nullptr) {
return;
}
@ -586,7 +586,7 @@ gfxCoreTextShaper::CreateDefaultFeaturesDescriptor()
CTFontRef
gfxCoreTextShaper::CreateCTFontWithDisabledLigatures(CGFloat aSize)
{
if (sDisableLigaturesDescriptor == NULL) {
if (sDisableLigaturesDescriptor == nullptr) {
// initialize cached descriptor to turn off the Common Ligatures feature
SInt16 val = kLigaturesType;
CFNumberRef ligaturesType =
@ -636,19 +636,19 @@ gfxCoreTextShaper::CreateCTFontWithDisabledLigatures(CGFloat aSize)
}
gfxMacFont *f = static_cast<gfxMacFont*>(mFont);
return ::CTFontCreateWithGraphicsFont(f->GetCGFontRef(), aSize, NULL,
return ::CTFontCreateWithGraphicsFont(f->GetCGFontRef(), aSize, nullptr,
sDisableLigaturesDescriptor);
}
void
gfxCoreTextShaper::Shutdown() // [static]
{
if (sDisableLigaturesDescriptor != NULL) {
if (sDisableLigaturesDescriptor != nullptr) {
::CFRelease(sDisableLigaturesDescriptor);
sDisableLigaturesDescriptor = NULL;
sDisableLigaturesDescriptor = nullptr;
}
if (sDefaultFeaturesDescriptor != NULL) {
if (sDefaultFeaturesDescriptor != nullptr) {
::CFRelease(sDefaultFeaturesDescriptor);
sDefaultFeaturesDescriptor = NULL;
sDefaultFeaturesDescriptor = nullptr;
}
}

View File

@ -47,7 +47,7 @@ protected:
static void CreateDefaultFeaturesDescriptor();
static CTFontDescriptorRef GetDefaultFeaturesDescriptor() {
if (sDefaultFeaturesDescriptor == NULL) {
if (sDefaultFeaturesDescriptor == nullptr) {
CreateDefaultFeaturesDescriptor();
}
return sDefaultFeaturesDescriptor;

View File

@ -83,7 +83,7 @@ void
gfxD2DSurface::ReleaseDC(const nsIntRect *aUpdatedRect)
{
if (!aUpdatedRect) {
return cairo_d2d_release_dc(CairoSurface(), NULL);
return cairo_d2d_release_dc(CairoSurface(), nullptr);
}
cairo_rectangle_int_t rect;

View File

@ -5,7 +5,7 @@
#include "gfxDWriteCommon.h"
IDWriteFontFileLoader* gfxDWriteFontFileLoader::mInstance = NULL;
IDWriteFontFileLoader* gfxDWriteFontFileLoader::mInstance = nullptr;
HRESULT STDMETHODCALLTYPE
gfxDWriteFontFileLoader::CreateStreamFromKey(const void *fontFileReferenceKey,
@ -61,7 +61,7 @@ gfxDWriteFontFileStream::ReadFileFragment(const void **fragmentStart,
}
// We should be alive for the duration of this.
*fragmentStart = &mData[fileOffset];
*fragmentContext = NULL;
*fragmentContext = nullptr;
return S_OK;
}

View File

@ -290,7 +290,7 @@ gfxDWriteFontEntry::CopyFontTable(uint32_t aTableTag,
uint32_t tableSize =
::GetFontData(dc.GetDC(),
NativeEndian::swapToBigEndian(aTableTag), 0,
NULL, 0);
nullptr, 0);
if (tableSize != GDI_ERROR) {
if (aBuffer.SetLength(tableSize)) {
::GetFontData(dc.GetDC(),
@ -312,7 +312,7 @@ gfxDWriteFontEntry::CopyFontTable(uint32_t aTableTag,
uint8_t *tableData;
uint32_t len;
void *tableContext = NULL;
void *tableContext = nullptr;
BOOL exists;
HRESULT hr =
fontFace->TryGetFontTable(NativeEndian::swapToBigEndian(aTableTag),
@ -481,7 +481,7 @@ gfxDWriteFontEntry::CreateFontFace(IDWriteFontFace **aFontFace,
// has the Bold simulation - unfortunately, DWrite doesn't provide
// a simple API for this
UINT32 numberOfFiles = 0;
if (FAILED(mFontFace->GetFiles(&numberOfFiles, NULL))) {
if (FAILED(mFontFace->GetFiles(&numberOfFiles, nullptr))) {
return NS_ERROR_FAILURE;
}
nsAutoTArray<IDWriteFontFile*,1> files;
@ -753,8 +753,8 @@ gfxDWriteFontList::InitFontList()
if (LOG_FONTINIT_ENABLED()) {
GetTimeFormat(LOCALE_INVARIANT, TIME_FORCE24HOURFORMAT,
NULL, NULL, nowTime, 256);
GetDateFormat(LOCALE_INVARIANT, 0, NULL, NULL, nowDate, 256);
nullptr, nullptr, nowTime, 256);
GetDateFormat(LOCALE_INVARIANT, 0, nullptr, nullptr, nowDate, 256);
}
upTime = (double) GetTickCount();
QueryPerformanceFrequency(&frequency);
@ -821,8 +821,8 @@ gfxDWriteFontList::DelayedInitFontList()
if (LOG_FONTINIT_ENABLED()) {
GetTimeFormat(LOCALE_INVARIANT, TIME_FORCE24HOURFORMAT,
NULL, NULL, nowTime, 256);
GetDateFormat(LOCALE_INVARIANT, 0, NULL, NULL, nowDate, 256);
nullptr, nullptr, nowTime, 256);
GetDateFormat(LOCALE_INVARIANT, 0, nullptr, nullptr, nowDate, 256);
}
upTime = (double) GetTickCount();
@ -1094,7 +1094,7 @@ gfxDWriteFontList::GetFontSubstitutes()
lenAlias = ArrayLength(aliasName);
actualName[0] = 0;
lenActual = sizeof(actualName);
rv = RegEnumValueW(hKey, i, aliasName, &lenAlias, NULL, &valueType,
rv = RegEnumValueW(hKey, i, aliasName, &lenAlias, nullptr, &valueType,
(LPBYTE)actualName, &lenActual);
if (rv != ERROR_SUCCESS || valueType != REG_SZ || lenAlias == 0) {
@ -1371,7 +1371,7 @@ gfxDWriteFontList::GlobalFontFallback(const uint32_t aCh,
// initialize text format
if (!mFallbackFormat) {
hr = dwFactory->CreateTextFormat(L"Arial", NULL,
hr = dwFactory->CreateTextFormat(L"Arial", nullptr,
DWRITE_FONT_WEIGHT_REGULAR,
DWRITE_FONT_STYLE_NORMAL,
DWRITE_FONT_STRETCH_NORMAL,
@ -1409,7 +1409,7 @@ gfxDWriteFontList::GlobalFontFallback(const uint32_t aCh,
// call the draw method to invoke the DirectWrite layout functions
// which determine the fallback font
hr = fallbackLayout->Draw(NULL, mFallbackRenderer, 50.0f, 50.0f);
hr = fallbackLayout->Draw(nullptr, mFallbackRenderer, 50.0f, 50.0f);
if (FAILED(hr)) {
return nullptr;
}

View File

@ -313,7 +313,7 @@ public:
} else if (__uuidof(IUnknown) == riid) {
*ppvObject = this;
} else {
*ppvObject = NULL;
*ppvObject = nullptr;
return E_FAIL;
}

View File

@ -491,7 +491,7 @@ gfxDWriteFont::SetupCairoFont(gfxContext *aContext)
bool
gfxDWriteFont::IsValid()
{
return mFontFace != NULL;
return mFontFace != nullptr;
}
IDWriteFontFace*

View File

@ -45,7 +45,7 @@ gfxDWriteShaper::ShapeText(gfxContext *aContext,
*/
UINT32 length = aLength;
TextAnalysis analysis(aText, length, NULL, readingDirection);
TextAnalysis analysis(aText, length, nullptr, readingDirection);
TextAnalysis::Run *runHead;
hr = analysis.GenerateResults(analyzer, &runHead);
@ -83,7 +83,7 @@ trymoreglyphs:
hr = analyzer->GetGlyphs(aText, length,
font->GetFontFace(), FALSE,
readingDirection == DWRITE_READING_DIRECTION_RIGHT_TO_LEFT,
&runHead->mScript, NULL, NULL, NULL, NULL, 0,
&runHead->mScript, nullptr, nullptr, nullptr, nullptr, 0,
maxGlyphs, clusters.Elements(), textProperties.Elements(),
indices.Elements(), glyphProperties.Elements(), &actualGlyphs);
@ -122,9 +122,9 @@ trymoreglyphs:
FALSE,
FALSE,
&runHead->mScript,
NULL,
NULL,
NULL,
nullptr,
nullptr,
nullptr,
0,
advances.Elements(),
glyphOffsets.Elements());
@ -141,9 +141,9 @@ trymoreglyphs:
FALSE,
FALSE,
&runHead->mScript,
NULL,
NULL,
NULL,
nullptr,
nullptr,
nullptr,
0,
advances.Elements(),
glyphOffsets.Elements());

View File

@ -13,7 +13,7 @@ TextAnalysis::TextAnalysis(const wchar_t* text,
, mTextLength(textLength)
, mLocaleName(localeName)
, mReadingDirection(readingDirection)
, mCurrentRun(NULL)
, mCurrentRun(nullptr)
{
}
@ -42,7 +42,7 @@ TextAnalysis::GenerateResults(IDWriteTextAnalyzer* textAnalyzer,
mRunHead.mTextLength = mTextLength;
mRunHead.mBidiLevel =
(mReadingDirection == DWRITE_READING_DIRECTION_RIGHT_TO_LEFT);
mRunHead.nextRun = NULL;
mRunHead.nextRun = nullptr;
mCurrentRun = &mRunHead;
// Call each of the analyzers in sequence, recording their results.
@ -67,7 +67,7 @@ TextAnalysis::GetTextAtPosition(UINT32 textPosition,
{
if (textPosition >= mTextLength) {
// No text at this position, valid query though.
*textString = NULL;
*textString = nullptr;
*textLength = 0;
} else {
*textString = mText + textPosition;
@ -85,7 +85,7 @@ TextAnalysis::GetTextBeforePosition(UINT32 textPosition,
if (textPosition == 0 || textPosition > mTextLength) {
// Either there is no text before here (== 0), or this
// is an invalid position. The query is considered valid thouh.
*textString = NULL;
*textString = nullptr;
*textLength = 0;
} else {
*textString = mText;
@ -122,7 +122,7 @@ TextAnalysis::GetNumberSubstitution(UINT32 textPosition,
OUT IDWriteNumberSubstitution** numberSubstitution)
{
// We do not support number substitution.
*numberSubstitution = NULL;
*numberSubstitution = nullptr;
*textLength = mTextLength - textPosition;
return S_OK;

View File

@ -91,7 +91,7 @@ gfxFT2FontBase::GetGlyph(uint32_t aCharCode)
void
gfxFT2FontBase::GetGlyphExtents(uint32_t aGlyph, cairo_text_extents_t* aExtents)
{
NS_PRECONDITION(aExtents != NULL, "aExtents must not be NULL");
NS_PRECONDITION(aExtents != nullptr, "aExtents must not be NULL");
cairo_glyph_t glyphs[1];
glyphs[0].index = aGlyph;

View File

@ -600,7 +600,7 @@ public:
MoveEntry,
PL_DHashClearEntryStub,
PL_DHashFinalizeStub,
NULL
nullptr
};
if (!PL_DHashTableInit(&mMap, &mOps, nullptr,
@ -659,12 +659,12 @@ public:
if (!(end = strchr(beginning, ';'))) {
break;
}
uint32_t timestamp = strtoul(beginning, NULL, 10);
uint32_t timestamp = strtoul(beginning, nullptr, 10);
beginning = end + 1;
if (!(end = strchr(beginning, ';'))) {
break;
}
uint32_t filesize = strtoul(beginning, NULL, 10);
uint32_t filesize = strtoul(beginning, nullptr, 10);
FNCMapEntry* mapEntry =
static_cast<FNCMapEntry*>
@ -829,7 +829,7 @@ gfxFT2FontList::AppendFacesFromCachedFaceList(const nsCString& aFileName,
if (!(end = strchr(beginning, ','))) {
break;
}
uint32_t index = strtoul(beginning, NULL, 10);
uint32_t index = strtoul(beginning, nullptr, 10);
beginning = end + 1;
if (!(end = strchr(beginning, ','))) {
break;
@ -839,12 +839,12 @@ gfxFT2FontList::AppendFacesFromCachedFaceList(const nsCString& aFileName,
if (!(end = strchr(beginning, ','))) {
break;
}
uint32_t weight = strtoul(beginning, NULL, 10);
uint32_t weight = strtoul(beginning, nullptr, 10);
beginning = end + 1;
if (!(end = strchr(beginning, ','))) {
break;
}
int32_t stretch = strtol(beginning, NULL, 10);
int32_t stretch = strtol(beginning, nullptr, 10);
FontListEntry fle(familyName, faceName, aFileName,
weight, stretch, italic, index);
@ -1157,7 +1157,7 @@ gfxFT2FontList::FindFonts()
FindExInfoStandard,
&results,
FindExSearchNameMatch,
NULL,
nullptr,
0);
bool moreFiles = handle != INVALID_HANDLE_VALUE;
while (moreFiles) {
@ -1276,8 +1276,8 @@ gfxFT2FontList::FindFontsInDir(const nsCString& aDir, FontNameCache *aFNC)
return;
}
struct dirent *ent = NULL;
while ((ent = readdir(d)) != NULL) {
struct dirent *ent = nullptr;
while ((ent = readdir(d)) != nullptr) {
int namelen = strlen(ent->d_name);
if (namelen <= 4) {
// cannot be a usable font filename

View File

@ -55,7 +55,7 @@ public:
// Create a font entry for a given freetype face; if it is an installed font,
// also record the filename and index.
// aFontData (if non-NULL) is NS_Malloc'ed data that aFace depends on,
// aFontData (if non-nullptr) is NS_Malloc'ed data that aFace depends on,
// to be freed after the face is destroyed
static FT2FontEntry*
CreateFontEntry(FT_Face aFace,

View File

@ -286,7 +286,7 @@ void gfxFT2FontGroup::GetCJKPrefFonts(nsTArray<nsRefPtr<gfxFontEntry> >& aFontEn
case 950: GetPrefFonts(nsGkAtoms::zh_tw, aFontEntryList); break;
}
#else
const char *ctype = setlocale(LC_CTYPE, NULL);
const char *ctype = setlocale(LC_CTYPE, nullptr);
if (ctype) {
if (!PL_strncasecmp(ctype, "ja", 2)) {
GetPrefFonts(nsGkAtoms::Japanese, aFontEntryList);

View File

@ -47,8 +47,8 @@ void
gfxFT2LockedFace::GetMetrics(gfxFont::Metrics* aMetrics,
uint32_t* aSpaceGlyph)
{
NS_PRECONDITION(aMetrics != NULL, "aMetrics must not be NULL");
NS_PRECONDITION(aSpaceGlyph != NULL, "aSpaceGlyph must not be NULL");
NS_PRECONDITION(aMetrics != nullptr, "aMetrics must not be NULL");
NS_PRECONDITION(aSpaceGlyph != nullptr, "aSpaceGlyph must not be NULL");
if (MOZ_UNLIKELY(!mFace)) {
// No face. This unfortunate situation might happen if the font
@ -323,7 +323,7 @@ gfxFT2LockedFace::GetUVSGlyph(uint32_t aCharCode, uint32_t aVariantSelector)
uint32_t
gfxFT2LockedFace::GetCharExtents(char aChar, cairo_text_extents_t* aExtents)
{
NS_PRECONDITION(aExtents != NULL, "aExtents must not be NULL");
NS_PRECONDITION(aExtents != nullptr, "aExtents must not be NULL");
if (!mFace)
return 0;

View File

@ -706,7 +706,7 @@ gfxFontFamily::FindFontForStyle(const gfxFontStyle& aFontStyle,
// Most families are "simple", having just Regular/Bold/Italic/BoldItalic,
// or some subset of these. In this case, we have exactly 4 entries in mAvailableFonts,
// stored in the above order; note that some of the entries may be NULL.
// stored in the above order; note that some of the entries may be nullptr.
// We can then pick the required entry based on whether the request is for
// bold or non-bold, italic or non-italic, without running the more complex
// matching algorithm used for larger families with many weights and/or widths.
@ -885,7 +885,7 @@ gfxFontFamily::FindWeightsForStyle(gfxFontEntry* aFontsForWeights[],
uint32_t count = mAvailableFonts.Length();
for (uint32_t i = 0; i < count; i++) {
// this is not called for "simple" families, and therefore it does not
// need to check the mAvailableFonts entries for NULL
// need to check the mAvailableFonts entries for nullptr.
gfxFontEntry *fe = mAvailableFonts[i];
uint32_t distance = StyleDistance(fe, anItalic, aStretch);
if (distance <= bestMatchDistance) {
@ -2526,8 +2526,8 @@ gfxFont::Draw(gfxTextRun *aTextRun, uint32_t aStart, uint32_t aEnd,
Matrix mat, matInv;
Matrix oldMat = dt->GetTransform();
// This is NULL when we have inverse-transformed glyphs and we need to
// transform the Brush inside flush.
// This is nullptr when we have inverse-transformed glyphs and we need
// to transform the Brush inside flush.
Matrix *passedInvMatrix = nullptr;
RefPtr<GlyphRenderingOptions> renderingOptions =

View File

@ -350,12 +350,12 @@ public:
// Subclasses should override this if they can provide more efficient
// access than copying table data into our own buffers.
//
// Get blob that encapsulates a specific font table, or NULL if
// Get blob that encapsulates a specific font table, or nullptr if
// the table doesn't exist in the font.
//
// Caller is responsible to call hb_blob_destroy() on the returned blob
// (if non-NULL) when no longer required. For transient access to a table,
// use of AutoTable (below) is generally preferred.
// (if non-nullptr) when no longer required. For transient access to a
// table, use of AutoTable (below) is generally preferred.
virtual hb_blob_t *GetFontTable(uint32_t aTag);
// Stack-based utility to return a specified table, automatically releasing
@ -395,8 +395,8 @@ public:
// reference is owned by the caller. Removing the last reference
// unregisters the table from the font entry.
//
// Pass NULL for aBuffer to indicate that the table is not present and
// NULL will be returned. Also returns NULL on OOM.
// Pass nullptr for aBuffer to indicate that the table is not present and
// nullptr will be returned. Also returns nullptr on OOM.
hb_blob_t *ShareFontTableAndGetBlob(uint32_t aTag,
FallibleTArray<uint8_t>* aTable);
@ -1548,7 +1548,7 @@ public:
* @param aDrawMode specifies whether the fill or stroke of the glyph should be
* drawn, or if it should be drawn into the current path
* @param aObjectPaint information about how to construct the fill and
* stroke pattern. Can be NULL if we are not stroking the text, which
* stroke pattern. Can be nullptr if we are not stroking the text, which
* indicates that the current source from aContext should be used for filling
*
* Callers guarantee:

View File

@ -308,7 +308,7 @@ gfxFontconfigUtils::NewPattern(const nsTArray<nsString>& aFamilies,
}
gfxFontconfigUtils::gfxFontconfigUtils()
: mLastConfig(NULL)
: mLastConfig(nullptr)
{
mFontsByFamily.Init(50);
mFontsByFullname.Init(50);
@ -477,7 +477,7 @@ gfxFontconfigUtils::GetSampleLangForGroup(nsIAtom *aLangGroup,
}
}
}
const char *ctype = setlocale(LC_CTYPE, NULL);
const char *ctype = setlocale(LC_CTYPE, nullptr);
if (ctype &&
TryLangForGroup(nsDependentCString(ctype), aLangGroup, aFcLang))
return;
@ -494,9 +494,9 @@ nsresult
gfxFontconfigUtils::GetFontListInternal(nsTArray<nsCString>& aListOfFonts,
nsIAtom *aLangGroup)
{
FcPattern *pat = NULL;
FcObjectSet *os = NULL;
FcFontSet *fs = NULL;
FcPattern *pat = nullptr;
FcObjectSet *os = nullptr;
FcFontSet *fs = nullptr;
nsresult rv = NS_ERROR_FAILURE;
aListOfFonts.Clear();
@ -505,7 +505,7 @@ gfxFontconfigUtils::GetFontListInternal(nsTArray<nsCString>& aListOfFonts,
if (!pat)
goto end;
os = FcObjectSetBuild(FC_FAMILY, NULL);
os = FcObjectSetBuild(FC_FAMILY, nullptr);
if (!os)
goto end;
@ -514,7 +514,7 @@ gfxFontconfigUtils::GetFontListInternal(nsTArray<nsCString>& aListOfFonts,
AddLangGroup(pat, aLangGroup);
}
fs = FcFontList(NULL, pat, os);
fs = FcFontList(nullptr, pat, os);
if (!fs)
goto end;
@ -564,8 +564,8 @@ gfxFontconfigUtils::UpdateFontListInternal(bool aForce)
// This checks periodically according to fontconfig's configured
// <rescan> interval.
FcInitBringUptoDate();
} else if (!FcConfigUptoDate(NULL)) { // check now with aForce
mLastConfig = NULL;
} else if (!FcConfigUptoDate(nullptr)) { // check now with aForce
mLastConfig = nullptr;
FcInitReinitialize();
}
@ -669,11 +669,11 @@ gfxFontconfigUtils::GetStandardFamilyName(const nsAString& aFontName, nsAString&
if (!IsExistingFamily(fontname))
return NS_OK;
FcPattern *pat = NULL;
FcObjectSet *os = NULL;
FcFontSet *givenFS = NULL;
FcPattern *pat = nullptr;
FcObjectSet *os = nullptr;
FcFontSet *givenFS = nullptr;
nsTArray<nsCString> candidates;
FcFontSet *candidateFS = NULL;
FcFontSet *candidateFS = nullptr;
rv = NS_ERROR_FAILURE;
pat = FcPatternCreate();
@ -682,11 +682,11 @@ gfxFontconfigUtils::GetStandardFamilyName(const nsAString& aFontName, nsAString&
FcPatternAddString(pat, FC_FAMILY, (FcChar8 *)fontname.get());
os = FcObjectSetBuild(FC_FAMILY, FC_FILE, FC_INDEX, NULL);
os = FcObjectSetBuild(FC_FAMILY, FC_FILE, FC_INDEX, nullptr);
if (!os)
goto end;
givenFS = FcFontList(NULL, pat, os);
givenFS = FcFontList(nullptr, pat, os);
if (!givenFS)
goto end;
@ -718,7 +718,7 @@ gfxFontconfigUtils::GetStandardFamilyName(const nsAString& aFontName, nsAString&
FcPatternDel(pat, FC_FAMILY);
FcPatternAddString(pat, FC_FAMILY, (FcChar8 *)candidates[j].get());
candidateFS = FcFontList(NULL, pat, os);
candidateFS = FcFontList(nullptr, pat, os);
if (!candidateFS)
goto end;
@ -834,7 +834,8 @@ bool
gfxFontconfigUtils::FontsByFullnameEntry::KeyEquals(KeyTypePointer aKey) const
{
const FcChar8 *key = mKey;
// If mKey is NULL, key comes from the style and family of the first font.
// If mKey is nullptr, key comes from the style and family of the first
// font.
nsAutoCString fullname;
if (!key) {
NS_ASSERTION(mFonts.Length(), "No font in FontsByFullnameEntry!");
@ -850,7 +851,7 @@ void
gfxFontconfigUtils::AddFullnameEntries()
{
// This FcFontSet is owned by fontconfig
FcFontSet *fontSet = FcConfigGetFonts(NULL, FcSetSystem);
FcFontSet *fontSet = FcConfigGetFonts(nullptr, FcSetSystem);
// Record the existing font families
for (int f = 0; f < fontSet->nfont; ++f) {
@ -866,8 +867,8 @@ gfxFontconfigUtils::AddFullnameEntries()
// will always succeed, and so the entry will always have a
// font from which to obtain the key.
bool added = entry->AddFont(font);
// The key may be NULL either if this is the first font, or if
// the first font does not have a fullname property, and so
// The key may be nullptr either if this is the first font, or
// if the first font does not have a fullname property, and so
// the key is obtained from the font. Set the key in both
// cases. The check that AddFont succeeded is required for
// the second case.
@ -890,8 +891,8 @@ gfxFontconfigUtils::AddFullnameEntries()
if (entry) {
entry->AddFont(font);
// Either entry->mKey has been set for a previous font or it
// remains NULL to indicate that the key is obtained from the
// first font.
// remains nullptr to indicate that the key is obtained from
// the first font.
}
}
}
@ -1008,7 +1009,7 @@ gfxFontconfigUtils::GetLangSupportEntry(const FcChar8 *aLang, bool aWithFonts)
}
// This FcFontSet is owned by fontconfig
FcFontSet *fontSet = FcConfigGetFonts(NULL, FcSetSystem);
FcFontSet *fontSet = FcConfigGetFonts(nullptr, FcSetSystem);
nsAutoTArray<FcPattern*,100> fonts;
@ -1046,7 +1047,7 @@ gfxFontconfigUtils::GetLangSupportEntry(const FcChar8 *aLang, bool aWithFonts)
// entry->mSupport needs to be recalculated, but this is an
// indication that the set of installed fonts has changed, so
// update all caches.
mLastConfig = NULL; // invalidates caches
mLastConfig = nullptr; // invalidates caches
UpdateFontListInternal(true);
return GetLangSupportEntry(aLang, aWithFonts);
}

View File

@ -181,11 +181,11 @@ public:
class DepFcStrEntry : public FcStrEntryBase {
public:
// When constructing a new entry in the hashtable, the key is left
// NULL. The caller of PutEntry() must fill in mKey when NULL. This
// provides a mechanism for the caller of PutEntry() to determine
// nullptr. The caller of PutEntry() must fill in mKey when nullptr.
// This provides a mechanism for the caller of PutEntry() to determine
// whether the entry has been initialized.
DepFcStrEntry(KeyTypePointer aName)
: mKey(NULL) { }
: mKey(nullptr) { }
DepFcStrEntry(const DepFcStrEntry& toCopy)
: mKey(toCopy.mKey) { }
@ -253,7 +253,7 @@ protected:
class FontsByFullnameEntry : public DepFcStrEntry {
public:
// When constructing a new entry in the hashtable, the key is left
// NULL. The caller of PutEntry() is must fill in mKey when adding
// nullptr. The caller of PutEntry() is must fill in mKey when adding
// the first font if the key is not derived from the family and style.
// If the key is derived from family and style, a font must be added.
FontsByFullnameEntry(KeyTypePointer aName)

View File

@ -40,7 +40,7 @@ gfxGDIFont::gfxGDIFont(GDIFontEntry *aFontEntry,
bool aNeedsBold,
AntialiasOption anAAOption)
: gfxFont(aFontEntry, aFontStyle, anAAOption),
mFont(NULL),
mFont(nullptr),
mFontFace(nullptr),
mMetrics(nullptr),
mSpaceGlyph(0),
@ -543,7 +543,7 @@ gfxGDIFont::GetGlyphWidth(gfxContext *aCtx, uint16_t aGID)
AutoSelectFont fs(dc, GetHFONT());
int devWidth;
if (GetCharWidthI(dc, aGID, 1, NULL, &devWidth)) {
if (GetCharWidthI(dc, aGID, 1, nullptr, &devWidth)) {
// ensure width is positive, 16.16 fixed-point value
width = (devWidth & 0x7fff) << 16;
mGlyphWidths.Put(aGID, width);

View File

@ -243,7 +243,8 @@ GDIFontEntry::CopyFontTable(uint32_t aTableTag,
if (font.IsValid()) {
uint32_t tableSize =
::GetFontData(dc.GetDC(),
NativeEndian::swapToBigEndian(aTableTag), 0, NULL, 0);
NativeEndian::swapToBigEndian(aTableTag),
0, nullptr, 0);
if (tableSize != GDI_ERROR) {
if (aBuffer.SetLength(tableSize)) {
::GetFontData(dc.GetDC(),
@ -343,14 +344,14 @@ GDIFontEntry::TestCharacterMap(uint32_t aCh)
} else {
// ScriptGetCMap works better than GetGlyphIndicesW
// for things like bitmap/vector fonts
SCRIPT_CACHE sc = NULL;
SCRIPT_CACHE sc = nullptr;
HRESULT rv = ScriptGetCMap(dc, &sc, str, 1, 0, glyph);
if (rv == S_OK)
hasGlyph = true;
}
SelectObject(dc, oldFont);
ReleaseDC(NULL, dc);
ReleaseDC(nullptr, dc);
if (hasGlyph) {
mCharacterMap->set(aCh);
@ -599,7 +600,7 @@ gfxGDIFontList::GetFontSubstitutes()
lenAlias = ArrayLength(aliasName);
actualName[0] = 0;
lenActual = sizeof(actualName);
rv = RegEnumValueW(hKey, i, aliasName, &lenAlias, NULL, &valueType,
rv = RegEnumValueW(hKey, i, aliasName, &lenAlias, nullptr, &valueType,
(LPBYTE)actualName, &lenActual);
if (rv != ERROR_SUCCESS || valueType != REG_SZ || lenAlias == 0) {

View File

@ -17,11 +17,11 @@ class AutoDC // get the global device context, and auto-release it on destructio
{
public:
AutoDC() {
mDC = ::GetDC(NULL);
mDC = ::GetDC(nullptr);
}
~AutoDC() {
::ReleaseDC(NULL, mDC);
::ReleaseDC(nullptr, mDC);
}
HDC GetDC() {
@ -44,7 +44,7 @@ public:
mDC = aDC;
mOldFont = (HFONT)::SelectObject(aDC, mFont);
} else {
mOldFont = NULL;
mOldFont = nullptr;
}
}
@ -66,7 +66,7 @@ public:
}
bool IsValid() const {
return mFont != NULL;
return mFont != nullptr;
}
HFONT GetFont() const {

View File

@ -52,7 +52,7 @@ gfxGDIShaper::ShapeText(gfxContext *aContext,
glyphs,
length,
INT_MAX,
NULL,
nullptr,
partialWidthArray.Elements(),
&size);
if (!success) {

View File

@ -44,7 +44,7 @@ gfxGdkNativeRenderer::DrawWithXlib(gfxXlibSurface* surface,
}
return DrawWithGDK(drawable, offset.x, offset.y,
numClipRects ? &clipRect : NULL, numClipRects);
numClipRects ? &clipRect : nullptr, numClipRects);
}
void

View File

@ -46,7 +46,7 @@ void
gfxImageSurface::MakeInvalid()
{
mSize = gfxIntSize(-1, -1);
mData = NULL;
mData = nullptr;
mStride = 0;
}

View File

@ -60,7 +60,7 @@ gfxMacFont::gfxMacFont(MacOSFontEntry *aFontEntry, const gfxFontStyle *aFontStyl
// synthetic oblique by skewing via the font matrix
bool needsOblique =
(mFontEntry != NULL) &&
(mFontEntry != nullptr) &&
(!mFontEntry->IsItalic() &&
(mStyle.style & (NS_FONT_STYLE_ITALIC | NS_FONT_STYLE_OBLIQUE)));
@ -369,7 +369,7 @@ gfxMacFont::InitMetricsFromPlatform()
{
CTFontRef ctFont = ::CTFontCreateWithGraphicsFont(mCGFont,
mAdjustedSize,
NULL, NULL);
nullptr, nullptr);
if (!ctFont) {
return;
}

View File

@ -356,7 +356,7 @@ cairo_font_face_t *gfxOS2Font::CairoFontFace()
// finally find a matching font
FcResult fcRes;
FcPattern *fcMatch = FcFontMatch(NULL, fcPattern, &fcRes);
FcPattern *fcMatch = FcFontMatch(nullptr, fcPattern, &fcRes);
// Most code that depends on FcFontMatch() assumes it won't fail,
// then crashes when it does. For now, at least, substitute the
@ -370,7 +370,7 @@ cairo_font_face_t *gfxOS2Font::CairoFontFace()
//#endif
// FcPatternAddString() will free the existing FC_FAMILY string
FcPatternAddString(fcPattern, FC_FAMILY, (FcChar8*)"SERIF");
fcMatch = FcFontMatch(NULL, fcPattern, &fcRes);
fcMatch = FcFontMatch(nullptr, fcPattern, &fcRes);
//#ifdef DEBUG
printf("Attempt to substitute default SERIF font %s\n",
fcMatch ? "succeeded" : "failed");
@ -449,7 +449,7 @@ bool gfxOS2Font::SetupCairoFont(gfxContext *aContext)
#endif
// gfxPangoFont checks the CTM but Windows doesn't so leave away here, too
// this implicitely ensures that mScaledFont is created if NULL
// this implicitely ensures that mScaledFont is created if nullptr
cairo_scaled_font_t *scaledFont = CairoScaledFont();
if (!scaledFont || cairo_scaled_font_status(scaledFont) != CAIRO_STATUS_SUCCESS) {
// Don't cairo_set_scaled_font as that would propagate the error to

View File

@ -149,7 +149,7 @@ gfxOS2Surface::~gfxOS2Surface()
}
} else {
if (mBitmap) {
GpiSetBitmap(mPS, NULL);
GpiSetBitmap(mPS, nullptr);
GpiDeleteBitmap(mBitmap);
}
if (mPS) {

View File

@ -79,7 +79,7 @@ FindFunctionSymbol(const char *name)
static bool HasChar(FcPattern *aFont, FcChar32 wc)
{
FcCharSet *charset = NULL;
FcCharSet *charset = nullptr;
FcPatternGetCharSet(aFont, FC_CHARSET, 0, &charset);
return charset && FcCharSetHasChar(charset, wc);
@ -187,7 +187,7 @@ public:
mFTFace(nullptr), mFTFaceInitialized(false)
{
cairo_font_face_reference(mFontFace);
cairo_font_face_set_user_data(mFontFace, &sFontEntryKey, this, NULL);
cairo_font_face_set_user_data(mFontFace, &sFontEntryKey, this, nullptr);
mPatterns.AppendElement();
// mPatterns is an nsAutoTArray with 1 space always available, so the
// AppendElement always succeeds.
@ -202,7 +202,10 @@ public:
~gfxSystemFcFontEntry()
{
cairo_font_face_set_user_data(mFontFace, &sFontEntryKey, NULL, NULL);
cairo_font_face_set_user_data(mFontFace,
&sFontEntryKey,
nullptr,
nullptr);
cairo_font_face_destroy(mFontFace);
}
@ -448,7 +451,7 @@ public:
const uint8_t *aData, FT_Face aFace)
: gfxUserFcFontEntry(aProxyEntry), mFontData(aData), mFace(aFace)
{
NS_PRECONDITION(aFace != NULL, "aFace is NULL!");
NS_PRECONDITION(aFace != nullptr, "aFace is NULL!");
InitPattern();
}
@ -536,16 +539,20 @@ gfxDownloadedFcFontEntry::InitPattern()
// available only from fontconfig-2.4.2 (December 2006). (CentOS 5.0 has
// fontconfig-2.4.1.)
if (sQueryFacePtr) {
// The "file" argument cannot be NULL (in fontconfig-2.6.0 at least).
// The dummy file passed here is removed below.
// The "file" argument cannot be nullptr (in fontconfig-2.6.0 at
// least). The dummy file passed here is removed below.
//
// When fontconfig scans the system fonts, FcConfigGetBlanks(NULL) is
// passed as the "blanks" argument, which provides that unexpectedly
// blank glyphs are elided. Here, however, we pass NULL for "blanks",
// effectively assuming that, if the font has a blank glyph, then the
// author intends any associated character to be rendered blank.
// When fontconfig scans the system fonts, FcConfigGetBlanks(nullptr)
// is passed as the "blanks" argument, which provides that unexpectedly
// blank glyphs are elided. Here, however, we pass nullptr for
// "blanks", effectively assuming that, if the font has a blank glyph,
// then the author intends any associated character to be rendered
// blank.
pattern =
(*sQueryFacePtr)(mFace, gfxFontconfigUtils::ToFcChar8(""), 0, NULL);
(*sQueryFacePtr)(mFace,
gfxFontconfigUtils::ToFcChar8(""),
0,
nullptr);
if (!pattern)
// Either OOM, or fontconfig chose to skip this font because it
// has "no encoded characters", which I think means "BDF and PCF
@ -561,7 +568,7 @@ gfxDownloadedFcFontEntry::InitPattern()
// Do the minimum necessary to construct a pattern for sorting.
// FC_CHARSET is vital to determine which characters are supported.
nsAutoRef<FcCharSet> charset(FcFreeTypeCharSet(mFace, NULL));
nsAutoRef<FcCharSet> charset(FcFreeTypeCharSet(mFace, nullptr));
// If there are no characters then assume we don't know how to read
// this font.
if (!charset || FcCharSetCount(charset) == 0)
@ -708,7 +715,7 @@ public:
// GetFontPatternAt sets up mFonts
FcPattern *fontPattern = GetFontPatternAt(i);
if (!fontPattern)
return NULL;
return nullptr;
mFonts[i].mFont =
gfxFcFont::GetOrMakeFont(mSortPattern, fontPattern,
@ -769,7 +776,7 @@ private:
// considered for mFonts.
int mFcFontsTrimmed;
// True iff fallback fonts are either stored in mFcFontSet or have been
// trimmed and added to mFonts (so that mFcFontSet is NULL).
// trimmed and added to mFonts (so that mFcFontSet is nullptr).
bool mHaveFallbackFonts;
// True iff there was a user font set with pending downloads,
// so the set may be updated when downloads complete
@ -1056,7 +1063,7 @@ gfxFcFontSet::SortPreferredFonts(bool &aWaitForUserFont)
}
}
FcPattern *truncateMarker = NULL;
FcPattern *truncateMarker = nullptr;
for (uint32_t r = 0; r < requiredLangs.Length(); ++r) {
const nsTArray< nsCountedRef<FcPattern> >& langFonts =
utils->GetFontsForLang(requiredLangs[r].mLang);
@ -1103,16 +1110,16 @@ gfxFcFontSet::SortPreferredFonts(bool &aWaitForUserFont)
FcFontSet *sets[1] = { fontSet };
FcResult result;
#ifdef SOLARIS
// Get around a crash of FcFontSetSort when FcConfig is NULL
// Get around a crash of FcFontSetSort when FcConfig is nullptr
// Solaris's FcFontSetSort needs an FcConfig (bug 474758)
fontSet.own(FcFontSetSort(FcConfigGetCurrent(), sets, 1, mSortPattern,
FcFalse, NULL, &result));
FcFalse, nullptr, &result));
#else
fontSet.own(FcFontSetSort(NULL, sets, 1, mSortPattern,
FcFalse, NULL, &result));
fontSet.own(FcFontSetSort(nullptr, sets, 1, mSortPattern,
FcFalse, nullptr, &result));
#endif
if (truncateMarker != NULL && fontSet) {
if (truncateMarker != nullptr && fontSet) {
nsAutoRef<FcFontSet> truncatedSet(FcFontSetCreate());
for (int f = 0; f < fontSet->nfont; ++f) {
@ -1143,8 +1150,8 @@ gfxFcFontSet::SortFallbackFonts()
// GetFontPatternAt() will trim lazily if and as needed, which will also
// remove duplicates of preferred fonts.
FcResult result;
return nsReturnRef<FcFontSet>(FcFontSort(NULL, mSortPattern,
FcFalse, NULL, &result));
return nsReturnRef<FcFontSet>(FcFontSort(nullptr, mSortPattern,
FcFalse, nullptr, &result));
}
// GetFontAt relies on this setting up all patterns up to |i|.
@ -1159,7 +1166,7 @@ gfxFcFontSet::GetFontPatternAt(uint32_t i)
mFcFontSet = SortFallbackFonts();
mHaveFallbackFonts = true;
mFcFontsTrimmed = 0;
// Loop to test that mFcFontSet is non-NULL.
// Loop to test that mFcFontSet is non-nullptr.
}
while (mFcFontsTrimmed < mFcFontSet->nfont) {
@ -1178,7 +1185,7 @@ gfxFcFontSet::GetFontPatternAt(uint32_t i)
}
if (supportedChars) {
FcCharSet *newChars = NULL;
FcCharSet *newChars = nullptr;
FcPatternGetCharSet(font, FC_CHARSET, 0, &newChars);
if (newChars) {
if (FcCharSetIsSubset(newChars, supportedChars))
@ -1214,7 +1221,7 @@ static void
PrepareSortPattern(FcPattern *aPattern, double aFallbackSize,
double aSizeAdjustFactor, bool aIsPrinterFont)
{
FcConfigSubstitute(NULL, aPattern, FcMatchPattern);
FcConfigSubstitute(nullptr, aPattern, FcMatchPattern);
// This gets cairo_font_options_t for the Screen. We should have
// different font options for printing (no hinting) but we are not told
@ -1553,7 +1560,7 @@ gfxPangoFontGroup::FindFontForChar(uint32_t aCh, uint32_t aPrevCh,
gfxFcFontSet *fontSet = GetBaseFontSet();
uint32_t nextFont = 0;
FcPattern *basePattern = NULL;
FcPattern *basePattern = nullptr;
if (!mStyle.systemFont && mPangoLanguage) {
basePattern = fontSet->GetFontPatternAt(0);
if (HasChar(basePattern, aCh)) {
@ -1617,12 +1624,15 @@ gfxFcFont::gfxFcFont(cairo_scaled_font_t *aCairoFont,
const gfxFontStyle *aFontStyle)
: gfxFT2FontBase(aCairoFont, aFontEntry, aFontStyle)
{
cairo_scaled_font_set_user_data(mScaledFont, &sGfxFontKey, this, NULL);
cairo_scaled_font_set_user_data(mScaledFont, &sGfxFontKey, this, nullptr);
}
gfxFcFont::~gfxFcFont()
{
cairo_scaled_font_set_user_data(mScaledFont, &sGfxFontKey, NULL, NULL);
cairo_scaled_font_set_user_data(mScaledFont,
&sGfxFontKey,
nullptr,
nullptr);
}
bool
@ -1669,7 +1679,7 @@ gfxPangoFontGroup::Shutdown()
{
// Resetting gFTLibrary in case this is wanted again after a
// cairo_debug_reset_static_data.
gFTLibrary = NULL;
gFTLibrary = nullptr;
}
/* static */ gfxFontEntry *
@ -1704,7 +1714,7 @@ gfxPangoFontGroup::NewFontEntry(const gfxProxyFontEntry &aProxyEntry,
NS_ConvertUTF16toUTF8 fullname(aFullname);
FcPatternAddString(pattern, FC_FULLNAME,
gfxFontconfigUtils::ToFcChar8(fullname));
FcConfigSubstitute(NULL, pattern, FcMatchPattern);
FcConfigSubstitute(nullptr, pattern, FcMatchPattern);
FcChar8 *name;
for (int v = 0;
@ -1739,11 +1749,11 @@ gfxPangoFontGroup::GetFTLibrary()
gfxFcFont *font = fontGroup->GetBaseFont();
if (!font)
return NULL;
return nullptr;
gfxFT2LockedFace face(font);
if (!face.get())
return NULL;
return nullptr;
gFTLibrary = face.get()->glyph->library;
}
@ -1759,7 +1769,7 @@ gfxPangoFontGroup::NewFontEntry(const gfxProxyFontEntry &aProxyEntry,
// new fontEntry, which will release it when no longer needed.
// Using face_index = 0 for the first face in the font, as we have no
// other information. FT_New_Memory_Face checks for a NULL FT_Library.
// other information. FT_New_Memory_Face checks for a nullptr FT_Library.
FT_Face face;
FT_Error error =
FT_New_Memory_Face(GetFTLibrary(), aFontData, aLength, 0, &face);
@ -1803,7 +1813,7 @@ gfxFcFont::GetOrMakeFont(FcPattern *aRequestedPattern, FcPattern *aFontPattern,
const gfxFontStyle *aFontStyle)
{
nsAutoRef<FcPattern> renderPattern
(FcFontRenderPrepare(NULL, aRequestedPattern, aFontPattern));
(FcFontRenderPrepare(nullptr, aRequestedPattern, aFontPattern));
cairo_font_face_t *face =
cairo_ft_font_face_create_for_pattern(renderPattern);
@ -2125,14 +2135,14 @@ PangoLanguage *
GuessPangoLanguage(nsIAtom *aLanguage)
{
if (!aLanguage)
return NULL;
return nullptr;
// Pango and fontconfig won't understand mozilla's internal langGroups, so
// find a real language.
nsAutoCString lang;
gfxFontconfigUtils::GetSampleLangForGroup(aLanguage, &lang);
if (lang.IsEmpty())
return NULL;
return nullptr;
return pango_language_from_string(lang.get());
}

View File

@ -52,9 +52,10 @@ public:
private:
// @param aLang [in] language to use for pref fonts and system default font
// selection, or NULL for the language guessed from the gfxFontStyle.
// selection, or nullptr for the language guessed from the
// gfxFontStyle.
// The FontGroup holds a reference to this set.
gfxFcFontSet *GetFontSet(PangoLanguage *aLang = NULL);
gfxFcFontSet *GetFontSet(PangoLanguage *aLang = nullptr);
class FontSetByLangEntry {
public:
@ -73,11 +74,11 @@ private:
nsIAtom *aLanguage);
// @param aLang [in] language to use for pref fonts and system font
// resolution, or NULL to guess a language from the gfxFontStyle.
// @param aMatchPattern [out] if non-NULL, will return the pattern used.
// resolution, or nullptr to guess a language from the gfxFontStyle.
// @param aMatchPattern [out] if non-nullptr, will return the pattern used.
already_AddRefed<gfxFcFontSet>
MakeFontSet(PangoLanguage *aLang, gfxFloat aSizeAdjustFactor,
nsAutoRef<FcPattern> *aMatchPattern = NULL);
nsAutoRef<FcPattern> *aMatchPattern = nullptr);
gfxFcFontSet *GetBaseFontSet();
gfxFcFont *GetBaseFont();

View File

@ -15,27 +15,27 @@
using namespace mozilla::gfx;
gfxPattern::gfxPattern(cairo_pattern_t *aPattern)
: mGfxPattern(NULL)
: mGfxPattern(nullptr)
{
mPattern = cairo_pattern_reference(aPattern);
}
gfxPattern::gfxPattern(const gfxRGBA& aColor)
: mGfxPattern(NULL)
: mGfxPattern(nullptr)
{
mPattern = cairo_pattern_create_rgba(aColor.r, aColor.g, aColor.b, aColor.a);
}
// from another surface
gfxPattern::gfxPattern(gfxASurface *surface)
: mGfxPattern(NULL)
: mGfxPattern(nullptr)
{
mPattern = cairo_pattern_create_for_surface(surface->CairoSurface());
}
// linear
gfxPattern::gfxPattern(gfxFloat x0, gfxFloat y0, gfxFloat x1, gfxFloat y1)
: mGfxPattern(NULL)
: mGfxPattern(nullptr)
{
mPattern = cairo_pattern_create_linear(x0, y0, x1, y1);
}
@ -43,7 +43,7 @@ gfxPattern::gfxPattern(gfxFloat x0, gfxFloat y0, gfxFloat x1, gfxFloat y1)
// radial
gfxPattern::gfxPattern(gfxFloat cx0, gfxFloat cy0, gfxFloat radius0,
gfxFloat cx1, gfxFloat cy1, gfxFloat radius1)
: mGfxPattern(NULL)
: mGfxPattern(nullptr)
{
mPattern = cairo_pattern_create_radial(cx0, cy0, radius0,
cx1, cy1, radius1);
@ -51,8 +51,8 @@ gfxPattern::gfxPattern(gfxFloat cx0, gfxFloat cy0, gfxFloat radius0,
// Azure
gfxPattern::gfxPattern(SourceSurface *aSurface, const Matrix &aTransform)
: mPattern(NULL)
, mGfxPattern(NULL)
: mPattern(nullptr)
, mGfxPattern(nullptr)
, mSourceSurface(aSurface)
, mTransform(aTransform)
, mExtend(EXTEND_NONE)
@ -78,7 +78,7 @@ void
gfxPattern::AddColorStop(gfxFloat offset, const gfxRGBA& c)
{
if (mPattern) {
mStops = NULL;
mStops = nullptr;
if (gfxPlatform::GetCMSMode() == eCMSMode_All) {
gfxRGBA cms;
qcms_transform *transform = gfxPlatform::GetCMSRGBTransform();
@ -177,7 +177,7 @@ gfxPattern::GetPattern(DrawTarget *aTarget, Matrix *aPatternTransform)
cairo_pattern_get_matrix(mPattern, &mat);
gfxMatrix matrix(*reinterpret_cast<gfxMatrix*>(&mat));
cairo_surface_t *surf = NULL;
cairo_surface_t *surf = nullptr;
cairo_pattern_get_surface(mPattern, &surf);
if (!mSourceSurface) {
@ -293,10 +293,10 @@ void
gfxPattern::SetExtend(GraphicsExtend extend)
{
if (mPattern) {
mStops = NULL;
mStops = nullptr;
if (extend == EXTEND_PAD_EDGE) {
if (cairo_pattern_get_type(mPattern) == CAIRO_PATTERN_TYPE_SURFACE) {
cairo_surface_t *surf = NULL;
cairo_surface_t *surf = nullptr;
cairo_pattern_get_surface (mPattern, &surf);
if (surf) {
@ -335,7 +335,7 @@ gfxPattern::IsOpaque()
switch (cairo_pattern_get_type(mPattern)) {
case CAIRO_PATTERN_TYPE_SURFACE:
{
cairo_surface_t *surf = NULL;
cairo_surface_t *surf = nullptr;
cairo_pattern_get_surface(mPattern, &surf);
if (cairo_surface_get_content(surf) == CAIRO_CONTENT_COLOR) {

View File

@ -45,7 +45,7 @@ public:
/* Get an Azure Pattern for the current Cairo pattern. aPattern transform
* specifies the transform that was set on the DrawTarget when the pattern
* was set. When this is NULL it is assumed the transform is identical
* was set. When this is nullptr it is assumed the transform is identical
* to the current transform.
*/
mozilla::gfx::Pattern *GetPattern(mozilla::gfx::DrawTarget *aTarget,

View File

@ -556,7 +556,7 @@ RefPtr<DrawTarget>
gfxPlatform::CreateDrawTargetForSurface(gfxASurface *aSurface, const IntSize& aSize)
{
RefPtr<DrawTarget> drawTarget = Factory::CreateDrawTargetForCairoSurface(aSurface->CairoSurface(), aSize);
aSurface->SetData(&kDrawTarget, drawTarget, NULL);
aSurface->SetData(&kDrawTarget, drawTarget, nullptr);
return drawTarget;
}
@ -604,13 +604,13 @@ void SourceSnapshotDetached(cairo_surface_t *nullSurf)
gfxImageSurface* origSurf =
static_cast<gfxImageSurface*>(cairo_surface_get_user_data(nullSurf, &kSourceSurface));
origSurf->SetData(&kSourceSurface, NULL, NULL);
origSurf->SetData(&kSourceSurface, nullptr, nullptr);
}
#else
void SourceSnapshotDetached(void *nullSurf)
{
gfxImageSurface* origSurf = static_cast<gfxImageSurface*>(nullSurf);
origSurf->SetData(&kSourceSurface, NULL, NULL);
origSurf->SetData(&kSourceSurface, nullptr, nullptr);
}
#endif
@ -738,7 +738,7 @@ gfxPlatform::GetSourceSurfaceForSurface(DrawTarget *aTarget, gfxASurface *aSurfa
cairo_surface_set_user_data(nullSurf,
&kSourceSurface,
imgSurface,
NULL);
nullptr);
cairo_surface_attach_snapshot(imgSurface->CairoSurface(), nullSurf, SourceSnapshotDetached);
cairo_surface_destroy(nullSurf);
#else
@ -849,7 +849,7 @@ gfxPlatform::CreateDrawTargetForBackend(BackendType aBackend, const IntSize& aSi
nsRefPtr<gfxASurface> surf = CreateOffscreenSurface(ThebesIntSize(aSize),
ContentForFormat(aFormat));
if (!surf || surf->CairoStatus()) {
return NULL;
return nullptr;
}
return CreateDrawTargetForSurface(surf, aSize);

View File

@ -493,7 +493,7 @@ public:
/**
* Convert a pixel using a cms transform in an endian-aware manner.
*
* Sets 'out' to 'in' if transform is NULL.
* Sets 'out' to 'in' if transform is nullptr.
*/
static void TransformPixel(const gfxRGBA& in, gfxRGBA& out, qcms_transform *transform);

View File

@ -59,11 +59,11 @@ gfxFontconfigUtils *gfxPlatformGtk::sFontconfigUtils = nullptr;
#ifndef MOZ_PANGO
typedef nsDataHashtable<nsStringHashKey, nsRefPtr<FontFamily> > FontTable;
typedef nsDataHashtable<nsCStringHashKey, nsTArray<nsRefPtr<gfxFontEntry> > > PrefFontTable;
static FontTable *gPlatformFonts = NULL;
static FontTable *gPlatformFontAliases = NULL;
static PrefFontTable *gPrefFonts = NULL;
static gfxSparseBitSet *gCodepointsWithNoFonts = NULL;
static FT_Library gPlatformFTLibrary = NULL;
static FontTable *gPlatformFonts = nullptr;
static FontTable *gPlatformFontAliases = nullptr;
static PrefFontTable *gPrefFonts = nullptr;
static gfxSparseBitSet *gCodepointsWithNoFonts = nullptr;
static FT_Library gPlatformFTLibrary = nullptr;
#endif
static cairo_user_data_key_t cairo_gdk_drawable_key;
@ -105,13 +105,13 @@ gfxPlatformGtk::~gfxPlatformGtk()
gfxPangoFontGroup::Shutdown();
#else
delete gPlatformFonts;
gPlatformFonts = NULL;
gPlatformFonts = nullptr;
delete gPlatformFontAliases;
gPlatformFontAliases = NULL;
gPlatformFontAliases = nullptr;
delete gPrefFonts;
gPrefFonts = NULL;
gPrefFonts = nullptr;
delete gCodepointsWithNoFonts;
gCodepointsWithNoFonts = NULL;
gCodepointsWithNoFonts = nullptr;
#ifdef NS_FREE_PERMANENT_DATA
// do cairo cleanup *before* closing down the FTLibrary,
@ -120,7 +120,7 @@ gfxPlatformGtk::~gfxPlatformGtk()
cairo_debug_reset_static_data();
FT_Done_FreeType(gPlatformFTLibrary);
gPlatformFTLibrary = NULL;
gPlatformFTLibrary = nullptr;
#endif
#endif
@ -283,15 +283,15 @@ gfxPlatformGtk::GetFontList(nsIAtom *aLangGroup,
nsresult
gfxPlatformGtk::UpdateFontList()
{
FcPattern *pat = NULL;
FcObjectSet *os = NULL;
FcFontSet *fs = NULL;
FcPattern *pat = nullptr;
FcObjectSet *os = nullptr;
FcFontSet *fs = nullptr;
int32_t result = -1;
pat = FcPatternCreate();
os = FcObjectSetBuild(FC_FAMILY, FC_FILE, FC_INDEX, FC_WEIGHT, FC_SLANT, FC_WIDTH, NULL);
os = FcObjectSetBuild(FC_FAMILY, FC_FILE, FC_INDEX, FC_WEIGHT, FC_SLANT, FC_WIDTH, nullptr);
fs = FcFontList(NULL, pat, os);
fs = FcFontList(nullptr, pat, os);
for (int i = 0; i < fs->nfont; i++) {
@ -376,8 +376,8 @@ gfxPlatformGtk::ResolveFontName(const nsAString& aFontName,
FcPattern *npat = FcPatternCreate();
FcPatternAddString(npat, FC_FAMILY, (FcChar8*)utf8Name.get());
FcObjectSet *nos = FcObjectSetBuild(FC_FAMILY, NULL);
FcFontSet *nfs = FcFontList(NULL, npat, nos);
FcObjectSet *nos = FcObjectSetBuild(FC_FAMILY, nullptr);
FcFontSet *nfs = FcFontList(nullptr, npat, nos);
for (int k = 0; k < nfs->nfont; k++) {
FcChar8 *str;
@ -401,15 +401,15 @@ gfxPlatformGtk::ResolveFontName(const nsAString& aFontName,
npat = FcPatternCreate();
FcPatternAddString(npat, FC_FAMILY, (FcChar8*)utf8Name.get());
FcPatternDel(npat, FC_LANG);
FcConfigSubstitute(NULL, npat, FcMatchPattern);
FcConfigSubstitute(nullptr, npat, FcMatchPattern);
FcDefaultSubstitute(npat);
nos = FcObjectSetBuild(FC_FAMILY, NULL);
nfs = FcFontList(NULL, npat, nos);
nos = FcObjectSetBuild(FC_FAMILY, nullptr);
nfs = FcFontList(nullptr, npat, nos);
FcResult fresult;
FcPattern *match = FcFontMatch(NULL, npat, &fresult);
FcPattern *match = FcFontMatch(nullptr, npat, &fresult);
if (match)
FcFontSetAdd(nfs, match);
@ -521,9 +521,9 @@ gfxPlatformGtk::GetPlatformCMSOutputProfile()
Display *dpy = GDK_DISPLAY_XDISPLAY(gdk_display_get_default());
// In xpcshell tests, we never initialize X and hence don't have a Display.
// In this case, there's no output colour management to be done, so we just
// return NULL.
// return nullptr.
if (!dpy) {
return NULL;
return nullptr;
}
Window root = gdk_x11_get_default_root_xwindow();
@ -541,7 +541,7 @@ gfxPlatformGtk::GetPlatformCMSOutputProfile()
False, AnyPropertyType,
&retAtom, &retFormat, &retLength,
&retAfter, &retProperty)) {
qcms_profile* profile = NULL;
qcms_profile* profile = nullptr;
if (retLength > 0)
profile = qcms_profile_from_memory(retProperty, retLength);
@ -739,7 +739,7 @@ GdkDrawable *
gfxPlatformGtk::GetGdkDrawable(gfxASurface *target)
{
if (target->CairoStatus())
return NULL;
return nullptr;
GdkDrawable *result;
@ -750,7 +750,7 @@ gfxPlatformGtk::GetGdkDrawable(gfxASurface *target)
#ifdef MOZ_X11
if (target->GetType() != gfxASurface::SurfaceTypeXlib)
return NULL;
return nullptr;
gfxXlibSurface *xs = static_cast<gfxXlibSurface*>(target);
@ -762,7 +762,7 @@ gfxPlatformGtk::GetGdkDrawable(gfxASurface *target)
}
#endif
return NULL;
return nullptr;
}
#endif
@ -777,6 +777,6 @@ gfxPlatformGtk::GetScaledFontForFont(DrawTarget* aTarget, gfxFont *aFont)
return Factory::CreateScaledFontForNativeFont(nativeFont, aFont->GetAdjustedSize());
}
return NULL;
return nullptr;
}

View File

@ -42,7 +42,7 @@ DisableFontActivation()
{
// get the main bundle identifier
CFBundleRef mainBundle = ::CFBundleGetMainBundle();
CFStringRef mainBundleID = NULL;
CFStringRef mainBundleID = nullptr;
if (mainBundle) {
mainBundleID = ::CFBundleGetIdentifier(mainBundle);
@ -470,7 +470,7 @@ gfxPlatformMac::GetPlatformCMSOutputProfile()
return nullptr;
// get the size of location
err = NCMGetProfileLocation(cmProfile, NULL, &locationSize);
err = NCMGetProfileLocation(cmProfile, nullptr, &locationSize);
if (err != noErr)
return nullptr;

View File

@ -38,7 +38,7 @@ gfxQtNativeRenderer::Draw(gfxContext* ctx, nsIntSize size,
tempCtx->Paint();
}
nsresult rv = DrawWithXlib(xsurf.get(), nsIntPoint(0, 0), NULL, 0);
nsresult rv = DrawWithXlib(xsurf.get(), nsIntPoint(0, 0), nullptr, 0);
if (NS_FAILED(rv))
return rv;

View File

@ -78,11 +78,11 @@ static gfxImageFormat sOffscreenFormat = gfxASurface::ImageFormatRGB24;
#ifndef MOZ_PANGO
typedef nsDataHashtable<nsStringHashKey, nsRefPtr<FontFamily> > FontTable;
typedef nsDataHashtable<nsCStringHashKey, nsTArray<nsRefPtr<FontEntry> > > PrefFontTable;
static FontTable *gPlatformFonts = NULL;
static FontTable *gPlatformFontAliases = NULL;
static PrefFontTable *gPrefFonts = NULL;
static gfxSparseBitSet *gCodepointsWithNoFonts = NULL;
static FT_Library gPlatformFTLibrary = NULL;
static FontTable *gPlatformFonts = nullptr;
static FontTable *gPlatformFontAliases = nullptr;
static PrefFontTable *gPrefFonts = nullptr;
static gfxSparseBitSet *gCodepointsWithNoFonts = nullptr;
static FT_Library gPlatformFTLibrary = nullptr;
#endif
gfxQtPlatform::gfxQtPlatform()
@ -152,18 +152,18 @@ gfxQtPlatform::~gfxQtPlatform()
gfxPangoFontGroup::Shutdown();
#else
delete gPlatformFonts;
gPlatformFonts = NULL;
gPlatformFonts = nullptr;
delete gPlatformFontAliases;
gPlatformFontAliases = NULL;
gPlatformFontAliases = nullptr;
delete gPrefFonts;
gPrefFonts = NULL;
gPrefFonts = nullptr;
delete gCodepointsWithNoFonts;
gCodepointsWithNoFonts = NULL;
gCodepointsWithNoFonts = nullptr;
cairo_debug_reset_static_data();
FT_Done_FreeType(gPlatformFTLibrary);
gPlatformFTLibrary = NULL;
gPlatformFTLibrary = nullptr;
#endif
#if 0
@ -260,14 +260,14 @@ nsresult
gfxQtPlatform::UpdateFontList()
{
#ifndef MOZ_PANGO
FcPattern *pat = NULL;
FcObjectSet *os = NULL;
FcFontSet *fs = NULL;
FcPattern *pat = nullptr;
FcObjectSet *os = nullptr;
FcFontSet *fs = nullptr;
pat = FcPatternCreate();
os = FcObjectSetBuild(FC_FAMILY, FC_FILE, FC_INDEX, FC_WEIGHT, FC_SLANT, FC_WIDTH, NULL);
os = FcObjectSetBuild(FC_FAMILY, FC_FILE, FC_INDEX, FC_WEIGHT, FC_SLANT, FC_WIDTH, nullptr);
fs = FcFontList(NULL, pat, os);
fs = FcFontList(nullptr, pat, os);
for (int i = 0; i < fs->nfont; i++) {
@ -383,8 +383,8 @@ gfxQtPlatform::ResolveFontName(const nsAString& aFontName,
FcPattern *npat = FcPatternCreate();
FcPatternAddString(npat, FC_FAMILY, (FcChar8*)utf8Name.get());
FcObjectSet *nos = FcObjectSetBuild(FC_FAMILY, NULL);
FcFontSet *nfs = FcFontList(NULL, npat, nos);
FcObjectSet *nos = FcObjectSetBuild(FC_FAMILY, nullptr);
FcFontSet *nfs = FcFontList(nullptr, npat, nos);
for (int k = 0; k < nfs->nfont; k++) {
FcChar8 *str;
@ -407,15 +407,15 @@ gfxQtPlatform::ResolveFontName(const nsAString& aFontName,
npat = FcPatternCreate();
FcPatternAddString(npat, FC_FAMILY, (FcChar8*)utf8Name.get());
FcPatternDel(npat, FC_LANG);
FcConfigSubstitute(NULL, npat, FcMatchPattern);
FcConfigSubstitute(nullptr, npat, FcMatchPattern);
FcDefaultSubstitute(npat);
nos = FcObjectSetBuild(FC_FAMILY, NULL);
nfs = FcFontList(NULL, npat, nos);
nos = FcObjectSetBuild(FC_FAMILY, nullptr);
nfs = FcFontList(nullptr, npat, nos);
FcResult fresult;
FcPattern *match = FcFontMatch(NULL, npat, &fresult);
FcPattern *match = FcFontMatch(nullptr, npat, &fresult);
if (match)
FcFontSetAdd(nfs, match);

View File

@ -10,7 +10,7 @@
gfxQuartzImageSurface::gfxQuartzImageSurface(gfxImageSurface *imageSurface)
{
if (imageSurface->CairoSurface() == NULL)
if (imageSurface->CairoSurface() == nullptr)
return;
cairo_surface_t *surf = cairo_quartz_image_surface_create (imageSurface->CairoSurface());

View File

@ -16,7 +16,7 @@ gfxQuartzSurface::MakeInvalid()
gfxQuartzSurface::gfxQuartzSurface(const gfxSize& desiredSize, gfxImageFormat format,
bool aForPrinting)
: mCGContext(NULL), mSize(desiredSize), mForPrinting(aForPrinting)
: mCGContext(nullptr), mSize(desiredSize), mForPrinting(aForPrinting)
{
gfxIntSize size((unsigned int) floor(desiredSize.width),
(unsigned int) floor(desiredSize.height));

View File

@ -184,7 +184,7 @@ public:
rv = ScriptPlace(placeDC, mShaper->ScriptCache(),
mGlyphs.Elements(), mNumGlyphs,
mAttr.Elements(), &sa,
mAdvances.Elements(), mOffsets.Elements(), NULL);
mAdvances.Elements(), mOffsets.Elements(), nullptr);
if (rv == E_PENDING) {
SelectFont();
@ -208,7 +208,7 @@ public:
memset(sfp, 0, sizeof(SCRIPT_FONTPROPERTIES));
sfp->cBytes = sizeof(SCRIPT_FONTPROPERTIES);
rv = ScriptGetFontProperties(NULL, mShaper->ScriptCache(),
rv = ScriptGetFontProperties(nullptr, mShaper->ScriptCache(),
sfp);
if (rv == E_PENDING) {
SelectFont();

View File

@ -19,7 +19,7 @@ class gfxUniscribeShaper : public gfxFontShaper
public:
gfxUniscribeShaper(gfxGDIFont *aFont)
: gfxFontShaper(aFont)
, mScriptCache(NULL)
, mScriptCache(nullptr)
{
MOZ_COUNT_CTOR(gfxUniscribeShaper);
}

View File

@ -297,7 +297,7 @@ gfxUserFontSet::OTSMessage(void *aUserData, const char *format, ...)
#endif
// Call the OTS library to sanitize an sfnt before attempting to use it.
// Returns a newly-allocated block, or NULL in case of fatal errors.
// Returns a newly-allocated block, or nullptr in case of fatal errors.
const uint8_t*
gfxUserFontSet::SanitizeOpenTypeData(gfxMixedFontFamily *aFamily,
gfxProxyFontEntry *aProxy,

View File

@ -862,5 +862,5 @@ gfxUtils::CopyAsDataURL(DrawTarget* aDT)
bool gfxUtils::sDumpPaintList = getenv("MOZ_DUMP_PAINT_LIST") != 0;
bool gfxUtils::sDumpPainting = getenv("MOZ_DUMP_PAINT") != 0;
bool gfxUtils::sDumpPaintingToFile = getenv("MOZ_DUMP_PAINT_TO_FILE") != 0;
FILE *gfxUtils::sDumpPaintFile = NULL;
FILE *gfxUtils::sDumpPaintFile = nullptr;
#endif

View File

@ -146,7 +146,7 @@ gfxWindowsNativeDrawing::BeginNativeDrawing()
SetViewportOrgEx(mDC,
mOrigViewportOrigin.x + (int)mDeviceOffset.x,
mOrigViewportOrigin.y + (int)mDeviceOffset.y,
NULL);
nullptr);
return mDC;
} else if (mRenderState == RENDER_STATE_ALPHA_RECOVERY_BLACK ||
@ -227,7 +227,7 @@ gfxWindowsNativeDrawing::EndNativeDrawing()
{
if (mRenderState == RENDER_STATE_NATIVE_DRAWING) {
// we drew directly to the HDC in the context; undo our changes
SetViewportOrgEx(mDC, mOrigViewportOrigin.x, mOrigViewportOrigin.y, NULL);
SetViewportOrgEx(mDC, mOrigViewportOrigin.x, mOrigViewportOrigin.y, nullptr);
if (mTransformType != TRANSLATION_ONLY)
SetWorldTransform(mDC, &mOldWorldTransform);

View File

@ -362,9 +362,9 @@ gfxWindowsPlatform::gfxWindowsPlatform()
/*
* Initialize COM
*/
CoInitialize(NULL);
CoInitialize(nullptr);
mScreenDC = GetDC(NULL);
mScreenDC = GetDC(nullptr);
#ifdef CAIRO_HAS_D2D_SURFACE
NS_RegisterMemoryReporter(new NS_MEMORY_REPORTER_NAME(D2DCache));
@ -384,7 +384,7 @@ gfxWindowsPlatform::~gfxWindowsPlatform()
{
NS_UnregisterMemoryMultiReporter(mGPUAdapterMultiReporter);
::ReleaseDC(NULL, mScreenDC);
::ReleaseDC(nullptr, mScreenDC);
// not calling FT_Done_FreeType because cairo may still hold references to
// these FT_Faces. See bug 458169.
#ifdef CAIRO_HAS_D2D_SURFACE
@ -521,7 +521,7 @@ gfxWindowsPlatform::CreateDevice(nsRefPtr<IDXGIAdapter1> &adapter1,
nsRefPtr<ID3D10Device1> device;
HRESULT hr =
createD3DDevice(adapter1, D3D10_DRIVER_TYPE_HARDWARE, NULL,
createD3DDevice(adapter1, D3D10_DRIVER_TYPE_HARDWARE, nullptr,
D3D10_CREATE_DEVICE_BGRA_SUPPORT |
D3D10_CREATE_DEVICE_PREVENT_INTERNAL_THREADING_OPTIMIZATIONS,
static_cast<D3D10_FEATURE_LEVEL1>(kSupportedFeatureLevels[featureLevelIndex]),
@ -752,7 +752,7 @@ gfxWindowsPlatform::GetThebesSurfaceForDrawTarget(DrawTarget *aTarget)
if (aTarget->GetType() == BACKEND_DIRECT2D) {
if (!GetD2DDevice()) {
// We no longer have a D2D device, can't do this.
return NULL;
return nullptr;
}
RefPtr<ID3D10Texture2D> texture =
@ -768,7 +768,7 @@ gfxWindowsPlatform::GetThebesSurfaceForDrawTarget(DrawTarget *aTarget)
new gfxD2DSurface(texture, ContentForFormat(aTarget->GetFormat()));
// shouldn't this hold a reference?
surf->SetData(&kDrawTarget, aTarget, NULL);
surf->SetData(&kDrawTarget, aTarget, nullptr);
return surf.forget();
}
#endif
@ -1172,7 +1172,7 @@ gfxWindowsPlatform::GetDLLVersion(const PRUnichar *aDLLPath, nsAString& aVersion
DWORD versInfoSize, vers[4] = {0};
// version info not available case
aVersion.Assign(NS_LITERAL_STRING("0.0.0.0"));
versInfoSize = GetFileVersionInfoSizeW(aDLLPath, NULL);
versInfoSize = GetFileVersionInfoSizeW(aDLLPath, nullptr);
nsAutoTArray<BYTE,512> versionInfo;
if (versInfoSize == 0 ||
@ -1231,7 +1231,8 @@ gfxWindowsPlatform::GetCleartypeParams(nsTArray<ClearTypeParameterInfo>& aParams
// enumerate over subkeys
for (i = 0, rv = ERROR_SUCCESS; rv != ERROR_NO_MORE_ITEMS; i++) {
size = ArrayLength(displayName);
rv = RegEnumKeyExW(hKey, i, displayName, &size, NULL, NULL, NULL, NULL);
rv = RegEnumKeyExW(hKey, i, displayName, &size,
nullptr, nullptr, nullptr, nullptr);
if (rv != ERROR_SUCCESS) {
continue;
}
@ -1251,7 +1252,7 @@ gfxWindowsPlatform::GetCleartypeParams(nsTArray<ClearTypeParameterInfo>& aParams
if (subrv == ERROR_SUCCESS) {
size = sizeof(value);
subrv = RegQueryValueExW(subKey, L"GammaLevel", NULL, &type,
subrv = RegQueryValueExW(subKey, L"GammaLevel", nullptr, &type,
(LPBYTE)&value, &size);
if (subrv == ERROR_SUCCESS && type == REG_DWORD) {
foundData = true;
@ -1259,7 +1260,7 @@ gfxWindowsPlatform::GetCleartypeParams(nsTArray<ClearTypeParameterInfo>& aParams
}
size = sizeof(value);
subrv = RegQueryValueExW(subKey, L"PixelStructure", NULL, &type,
subrv = RegQueryValueExW(subKey, L"PixelStructure", nullptr, &type,
(LPBYTE)&value, &size);
if (subrv == ERROR_SUCCESS && type == REG_DWORD) {
foundData = true;
@ -1275,7 +1276,7 @@ gfxWindowsPlatform::GetCleartypeParams(nsTArray<ClearTypeParameterInfo>& aParams
if (subrv == ERROR_SUCCESS) {
size = sizeof(value);
subrv = RegQueryValueExW(subKey, L"ClearTypeLevel", NULL, &type,
subrv = RegQueryValueExW(subKey, L"ClearTypeLevel", nullptr, &type,
(LPBYTE)&value, &size);
if (subrv == ERROR_SUCCESS && type == REG_DWORD) {
foundData = true;
@ -1284,7 +1285,7 @@ gfxWindowsPlatform::GetCleartypeParams(nsTArray<ClearTypeParameterInfo>& aParams
size = sizeof(value);
subrv = RegQueryValueExW(subKey, L"EnhancedContrastLevel",
NULL, &type, (LPBYTE)&value, &size);
nullptr, &type, (LPBYTE)&value, &size);
if (subrv == ERROR_SUCCESS && type == REG_DWORD) {
foundData = true;
ctinfo.enhancedContrast = value;
@ -1478,7 +1479,7 @@ gfxWindowsPlatform::GetD3D11Device()
return nullptr;
}
HRESULT hr = d3d11CreateDevice(adapter, D3D_DRIVER_TYPE_UNKNOWN, NULL,
HRESULT hr = d3d11CreateDevice(adapter, D3D_DRIVER_TYPE_UNKNOWN, nullptr,
D3D11_CREATE_DEVICE_BGRA_SUPPORT,
featureLevels.Elements(), featureLevels.Length(),
D3D11_SDK_VERSION, byRef(mD3D11Device), nullptr, nullptr);

View File

@ -52,7 +52,7 @@ class nsIMemoryMultiReporter;
// used by both GDI and Uniscribe font shapers
struct DCFromContext {
DCFromContext(gfxContext *aContext) {
dc = NULL;
dc = nullptr;
nsRefPtr<gfxASurface> aSurface = aContext->CurrentSurface();
NS_ASSERTION(aSurface, "DCFromContext: null surface");
if (aSurface &&
@ -67,7 +67,7 @@ struct DCFromContext {
cairo_win32_scaled_font_select_font(scaled, dc);
}
if (!dc) {
dc = GetDC(NULL);
dc = GetDC(nullptr);
SetGraphicsMode(dc, GM_ADVANCED);
needsRelease = true;
}
@ -75,7 +75,7 @@ struct DCFromContext {
~DCFromContext() {
if (needsRelease) {
ReleaseDC(NULL, dc);
ReleaseDC(nullptr, dc);
} else {
RestoreDC(dc, -1);
}

View File

@ -224,7 +224,7 @@ gfxWindowsSurface::BeginPrinting(const nsAString& aTitle,
docinfo.cbSize = sizeof(docinfo);
docinfo.lpszDocName = titleStr.Length() > 0 ? titleStr.get() : L"Mozilla Document";
docinfo.lpszOutput = docName.Length() > 0 ? docName.get() : nullptr;
docinfo.lpszDatatype = NULL;
docinfo.lpszDatatype = nullptr;
docinfo.fwType = 0;
::StartDocW(mDC, &docinfo);

View File

@ -31,7 +31,7 @@ public:
gfxWindowsSurface(const gfxIntSize& size,
gfxImageFormat imageFormat = ImageFormatRGB24);
// Create a DDB surface; dc may be NULL to use the screen DC
// Create a DDB surface; dc may be nullptr to use the screen DC
gfxWindowsSurface(HDC dc,
const gfxIntSize& size,
gfxImageFormat imageFormat = ImageFormatRGB24);

View File

@ -320,8 +320,8 @@ CreateTempXlibSurface (gfxASurface *destination, nsIntSize size,
// Analyse the pixel formats either to check whether we can
// doCopyBackground or to see if we can find a better visual for
// opaque drawing.
Visual *target_visual = NULL;
XRenderPictFormat *target_format = NULL;
Visual *target_visual = nullptr;
XRenderPictFormat *target_format = nullptr;
switch (target_type) {
case CAIRO_SURFACE_TYPE_XLIB:
target_visual = cairo_xlib_surface_get_visual (target);
@ -419,7 +419,7 @@ gfxXlibNativeRenderer::DrawOntoTempSurface(gfxXlibSurface *tempXlibSurface,
tempXlibSurface->Flush();
/* no clipping is needed because the callback can't draw outside the native
surface anyway */
nsresult rv = DrawWithXlib(tempXlibSurface, offset, NULL, 0);
nsresult rv = DrawWithXlib(tempXlibSurface, offset, nullptr, 0);
tempXlibSurface->MarkDirty();
return NS_SUCCEEDED(rv);
}
@ -445,7 +445,7 @@ gfxXlibNativeRenderer::Draw(gfxContext* ctx, nsIntSize size,
DrawOutput* result)
{
if (result) {
result->mSurface = NULL;
result->mSurface = nullptr;
result->mUniformAlpha = false;
result->mUniformColor = false;
}
@ -520,7 +520,7 @@ gfxXlibNativeRenderer::Draw(gfxContext* ctx, nsIntSize size,
if (drawingRect.Size() != size || method == eCopyBackground) {
// Only drawing a portion, or copying background,
// so won't return a result.
result = NULL;
result = nullptr;
}
nsRefPtr<gfxContext> tmpCtx;

View File

@ -458,7 +458,7 @@ gfxXlibSurface::FindVisual(Screen *screen, gfxImageFormat format)
case ImageFormatA8:
case ImageFormatA1:
default:
return NULL;
return nullptr;
}
for (int d = 0; d < screen->ndepths; d++) {
@ -477,7 +477,7 @@ gfxXlibSurface::FindVisual(Screen *screen, gfxImageFormat format)
}
}
return NULL;
return nullptr;
}
/* static */
@ -495,7 +495,7 @@ gfxXlibSurface::FindRenderFormat(Display *dpy, gfxImageFormat format)
// and find xrender format by visual
Visual *visual = FindVisual(DefaultScreenOfDisplay(dpy), format);
if (!visual)
return NULL;
return nullptr;
return XRenderFindVisualFormat(dpy, visual);
}
case ImageFormatA8:
@ -506,7 +506,7 @@ gfxXlibSurface::FindRenderFormat(Display *dpy, gfxImageFormat format)
break;
}
return (XRenderPictFormat*)NULL;
return nullptr;
}
Screen*

View File

@ -52,11 +52,11 @@ public:
jobject CreateSurfaceTexture(GLuint aTexture)
{
if (!EnsureInitialized())
return NULL;
return nullptr;
JNIEnv* env = GetJNIForThread();
if (!env)
return NULL;
return nullptr;
AutoLocalJNIFrame jniFrame(env);
@ -93,7 +93,7 @@ public:
jfloatArray jarray = env->NewFloatArray(16);
env->CallVoidMethod(aSurfaceTexture, jSurfaceTexture_getTransformMatrix, jarray);
jfloat* array = env->GetFloatArrayElements(jarray, NULL);
jfloat* array = env->GetFloatArrayElements(jarray, nullptr);
aMatrix._11 = array[0];
aMatrix._12 = array[1];
@ -136,13 +136,13 @@ nsSurfaceTexture::Create(GLuint aTexture)
// Right now we only support creating this on the main thread because
// of the JNIEnv assumptions in JNIHelper and elsewhere
if (!NS_IsMainThread())
return NULL;
return nullptr;
nsSurfaceTexture* st = new nsSurfaceTexture();
if (!st->Init(aTexture)) {
LOG("Failed to initialize nsSurfaceTexture");
delete st;
st = NULL;
st = nullptr;
}
return st;
@ -155,7 +155,7 @@ nsSurfaceTexture::Find(int id)
it = sInstances.find(id);
if (it == sInstances.end())
return NULL;
return nullptr;
return it->second;
}
@ -189,7 +189,7 @@ nsSurfaceTexture::Init(GLuint aTexture)
}
nsSurfaceTexture::nsSurfaceTexture()
: mSurfaceTexture(NULL), mNativeWindow(NULL)
: mSurfaceTexture(nullptr), mNativeWindow(nullptr)
{
}
@ -197,11 +197,11 @@ nsSurfaceTexture::~nsSurfaceTexture()
{
sInstances.erase(mID);
mFrameAvailableCallback = NULL;
mFrameAvailableCallback = nullptr;
if (mNativeWindow) {
AndroidBridge::Bridge()->ReleaseNativeWindowForSurfaceTexture(mSurfaceTexture);
mNativeWindow = NULL;
mNativeWindow = nullptr;
}
JNIEnv* env = GetJNIForThread();
@ -212,7 +212,7 @@ nsSurfaceTexture::~nsSurfaceTexture()
AndroidBridge::Bridge()->UnregisterSurfaceTextureFrameListener(mSurfaceTexture);
env->DeleteGlobalRef(mSurfaceTexture);
mSurfaceTexture = NULL;
mSurfaceTexture = nullptr;
}
}