From c742394e7573766bf54b3b75f61e0fbc16fd99c0 Mon Sep 17 00:00:00 2001 From: Birunthan Mohanathas Date: Wed, 31 Jul 2013 11:44:31 -0400 Subject: [PATCH] Bug 784739 - Switch from NULL to nullptr in gfx/thebes/; r=ehsan --- gfx/thebes/gfxASurface.cpp | 4 +- gfx/thebes/gfxAndroidPlatform.cpp | 4 +- gfx/thebes/gfxBlur.h | 11 ++-- gfx/thebes/gfxContext.cpp | 59 +++++++++--------- gfx/thebes/gfxContext.h | 4 +- gfx/thebes/gfxCoreTextShaper.cpp | 28 ++++----- gfx/thebes/gfxCoreTextShaper.h | 2 +- gfx/thebes/gfxD2DSurface.cpp | 2 +- gfx/thebes/gfxDWriteCommon.cpp | 4 +- gfx/thebes/gfxDWriteFontList.cpp | 20 +++--- gfx/thebes/gfxDWriteFontList.h | 2 +- gfx/thebes/gfxDWriteFonts.cpp | 2 +- gfx/thebes/gfxDWriteShaper.cpp | 16 ++--- gfx/thebes/gfxDWriteTextAnalysis.cpp | 10 +-- gfx/thebes/gfxFT2FontBase.cpp | 2 +- gfx/thebes/gfxFT2FontList.cpp | 18 +++--- gfx/thebes/gfxFT2FontList.h | 2 +- gfx/thebes/gfxFT2Fonts.cpp | 2 +- gfx/thebes/gfxFT2Utils.cpp | 6 +- gfx/thebes/gfxFont.cpp | 8 +-- gfx/thebes/gfxFont.h | 12 ++-- gfx/thebes/gfxFontconfigUtils.cpp | 49 +++++++-------- gfx/thebes/gfxFontconfigUtils.h | 8 +-- gfx/thebes/gfxGDIFont.cpp | 4 +- gfx/thebes/gfxGDIFontList.cpp | 9 +-- gfx/thebes/gfxGDIFontList.h | 8 +-- gfx/thebes/gfxGDIShaper.cpp | 2 +- gfx/thebes/gfxGdkNativeRenderer.cpp | 2 +- gfx/thebes/gfxImageSurface.cpp | 2 +- gfx/thebes/gfxMacFont.cpp | 4 +- gfx/thebes/gfxOS2Fonts.cpp | 6 +- gfx/thebes/gfxOS2Surface.cpp | 2 +- gfx/thebes/gfxPangoFonts.cpp | 84 ++++++++++++++------------ gfx/thebes/gfxPangoFonts.h | 11 ++-- gfx/thebes/gfxPattern.cpp | 24 ++++---- gfx/thebes/gfxPattern.h | 2 +- gfx/thebes/gfxPlatform.cpp | 10 +-- gfx/thebes/gfxPlatform.h | 2 +- gfx/thebes/gfxPlatformGtk.cpp | 56 ++++++++--------- gfx/thebes/gfxPlatformMac.cpp | 4 +- gfx/thebes/gfxQtNativeRenderer.cpp | 2 +- gfx/thebes/gfxQtPlatform.cpp | 42 ++++++------- gfx/thebes/gfxQuartzImageSurface.cpp | 2 +- gfx/thebes/gfxQuartzSurface.cpp | 2 +- gfx/thebes/gfxUniscribeShaper.cpp | 4 +- gfx/thebes/gfxUniscribeShaper.h | 2 +- gfx/thebes/gfxUserFontSet.cpp | 2 +- gfx/thebes/gfxUtils.cpp | 2 +- gfx/thebes/gfxWindowsNativeDrawing.cpp | 4 +- gfx/thebes/gfxWindowsPlatform.cpp | 27 +++++---- gfx/thebes/gfxWindowsPlatform.h | 6 +- gfx/thebes/gfxWindowsSurface.cpp | 2 +- gfx/thebes/gfxWindowsSurface.h | 2 +- gfx/thebes/gfxXlibNativeRenderer.cpp | 10 +-- gfx/thebes/gfxXlibSurface.cpp | 8 +-- gfx/thebes/nsSurfaceTexture.cpp | 20 +++--- 56 files changed, 330 insertions(+), 314 deletions(-) diff --git a/gfx/thebes/gfxASurface.cpp b/gfx/thebes/gfxASurface.cpp index 15b327b259fe..37fa78aba4f8 100644 --- a/gfx/thebes/gfxASurface.cpp +++ b/gfx/thebes/gfxASurface.cpp @@ -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); } diff --git a/gfx/thebes/gfxAndroidPlatform.cpp b/gfx/thebes/gfxAndroidPlatform.cpp index de25e84f11c0..628c6093b0b1 100644 --- a/gfx/thebes/gfxAndroidPlatform.cpp +++ b/gfx/thebes/gfxAndroidPlatform.cpp @@ -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 diff --git a/gfx/thebes/gfxBlur.h b/gfx/thebes/gfxBlur.h index 152495dff6cf..70e3250c1fbd 100644 --- a/gfx/thebes/gfxBlur.h +++ b/gfx/thebes/gfxBlur.h @@ -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, diff --git a/gfx/thebes/gfxContext.cpp b/gfx/thebes/gfxContext.cpp index a2f6da06bfa2..e2e5e7eeb9b0 100644 --- a/gfx/thebes/gfxContext.cpp +++ b/gfx/thebes/gfxContext.cpp @@ -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 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); diff --git a/gfx/thebes/gfxContext.h b/gfx/thebes/gfxContext.h index 10ecb648016a..8f4714a5d950 100644 --- a/gfx/thebes/gfxContext.h +++ b/gfx/thebes/gfxContext.h @@ -67,7 +67,7 @@ public: */ already_AddRefed CurrentSurface(gfxFloat *dx, gfxFloat *dy); already_AddRefed 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& dashes, gfxFloat* offset) const; // Returns 0.0 if dashing isn't enabled. diff --git a/gfx/thebes/gfxCoreTextShaper.cpp b/gfx/thebes/gfxCoreTextShaper.cpp index 62b5b788c1fb..e1949291e02f 100644 --- a/gfx/thebes/gfxCoreTextShaper.cpp +++ b/gfx/thebes/gfxCoreTextShaper.cpp @@ -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 glyphsArray; nsAutoArrayPtr positionsArray; nsAutoArrayPtr 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 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(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; } } diff --git a/gfx/thebes/gfxCoreTextShaper.h b/gfx/thebes/gfxCoreTextShaper.h index aa22dcb6da42..5928da69112e 100644 --- a/gfx/thebes/gfxCoreTextShaper.h +++ b/gfx/thebes/gfxCoreTextShaper.h @@ -47,7 +47,7 @@ protected: static void CreateDefaultFeaturesDescriptor(); static CTFontDescriptorRef GetDefaultFeaturesDescriptor() { - if (sDefaultFeaturesDescriptor == NULL) { + if (sDefaultFeaturesDescriptor == nullptr) { CreateDefaultFeaturesDescriptor(); } return sDefaultFeaturesDescriptor; diff --git a/gfx/thebes/gfxD2DSurface.cpp b/gfx/thebes/gfxD2DSurface.cpp index 941ff7a5959f..475dd42144a0 100644 --- a/gfx/thebes/gfxD2DSurface.cpp +++ b/gfx/thebes/gfxD2DSurface.cpp @@ -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; diff --git a/gfx/thebes/gfxDWriteCommon.cpp b/gfx/thebes/gfxDWriteCommon.cpp index 844397f39368..e91388f326b9 100644 --- a/gfx/thebes/gfxDWriteCommon.cpp +++ b/gfx/thebes/gfxDWriteCommon.cpp @@ -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; } diff --git a/gfx/thebes/gfxDWriteFontList.cpp b/gfx/thebes/gfxDWriteFontList.cpp index f8e3b728e42e..cfb5a599ebc6 100644 --- a/gfx/thebes/gfxDWriteFontList.cpp +++ b/gfx/thebes/gfxDWriteFontList.cpp @@ -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 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; } diff --git a/gfx/thebes/gfxDWriteFontList.h b/gfx/thebes/gfxDWriteFontList.h index 1a1c17372307..07eb67b247d2 100644 --- a/gfx/thebes/gfxDWriteFontList.h +++ b/gfx/thebes/gfxDWriteFontList.h @@ -313,7 +313,7 @@ public: } else if (__uuidof(IUnknown) == riid) { *ppvObject = this; } else { - *ppvObject = NULL; + *ppvObject = nullptr; return E_FAIL; } diff --git a/gfx/thebes/gfxDWriteFonts.cpp b/gfx/thebes/gfxDWriteFonts.cpp index 094a98aa71ec..0bf9617380aa 100644 --- a/gfx/thebes/gfxDWriteFonts.cpp +++ b/gfx/thebes/gfxDWriteFonts.cpp @@ -491,7 +491,7 @@ gfxDWriteFont::SetupCairoFont(gfxContext *aContext) bool gfxDWriteFont::IsValid() { - return mFontFace != NULL; + return mFontFace != nullptr; } IDWriteFontFace* diff --git a/gfx/thebes/gfxDWriteShaper.cpp b/gfx/thebes/gfxDWriteShaper.cpp index 0934516a4897..39c58916f13d 100644 --- a/gfx/thebes/gfxDWriteShaper.cpp +++ b/gfx/thebes/gfxDWriteShaper.cpp @@ -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()); diff --git a/gfx/thebes/gfxDWriteTextAnalysis.cpp b/gfx/thebes/gfxDWriteTextAnalysis.cpp index 95e1d2cde34b..fc97f05939de 100644 --- a/gfx/thebes/gfxDWriteTextAnalysis.cpp +++ b/gfx/thebes/gfxDWriteTextAnalysis.cpp @@ -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; diff --git a/gfx/thebes/gfxFT2FontBase.cpp b/gfx/thebes/gfxFT2FontBase.cpp index 1b91810936f6..42c94490c562 100644 --- a/gfx/thebes/gfxFT2FontBase.cpp +++ b/gfx/thebes/gfxFT2FontBase.cpp @@ -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; diff --git a/gfx/thebes/gfxFT2FontList.cpp b/gfx/thebes/gfxFT2FontList.cpp index b2ad898c386a..3b26886f6a51 100644 --- a/gfx/thebes/gfxFT2FontList.cpp +++ b/gfx/thebes/gfxFT2FontList.cpp @@ -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 @@ -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 diff --git a/gfx/thebes/gfxFT2FontList.h b/gfx/thebes/gfxFT2FontList.h index decf489c2eb8..1b37ec1083c1 100644 --- a/gfx/thebes/gfxFT2FontList.h +++ b/gfx/thebes/gfxFT2FontList.h @@ -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, diff --git a/gfx/thebes/gfxFT2Fonts.cpp b/gfx/thebes/gfxFT2Fonts.cpp index cf84193ae067..fa9768ed1bc8 100644 --- a/gfx/thebes/gfxFT2Fonts.cpp +++ b/gfx/thebes/gfxFT2Fonts.cpp @@ -286,7 +286,7 @@ void gfxFT2FontGroup::GetCJKPrefFonts(nsTArray >& 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); diff --git a/gfx/thebes/gfxFT2Utils.cpp b/gfx/thebes/gfxFT2Utils.cpp index 25efc2795483..acc058e73353 100644 --- a/gfx/thebes/gfxFT2Utils.cpp +++ b/gfx/thebes/gfxFT2Utils.cpp @@ -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; diff --git a/gfx/thebes/gfxFont.cpp b/gfx/thebes/gfxFont.cpp index 8790586e693e..a7b074777361 100644 --- a/gfx/thebes/gfxFont.cpp +++ b/gfx/thebes/gfxFont.cpp @@ -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 renderingOptions = diff --git a/gfx/thebes/gfxFont.h b/gfx/thebes/gfxFont.h index 93ebad8ec07c..332b962261ff 100644 --- a/gfx/thebes/gfxFont.h +++ b/gfx/thebes/gfxFont.h @@ -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* 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: diff --git a/gfx/thebes/gfxFontconfigUtils.cpp b/gfx/thebes/gfxFontconfigUtils.cpp index 7888308e339f..7c98c59d7d6b 100644 --- a/gfx/thebes/gfxFontconfigUtils.cpp +++ b/gfx/thebes/gfxFontconfigUtils.cpp @@ -308,7 +308,7 @@ gfxFontconfigUtils::NewPattern(const nsTArray& 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& 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& 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& 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 // 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 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 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); } diff --git a/gfx/thebes/gfxFontconfigUtils.h b/gfx/thebes/gfxFontconfigUtils.h index b8af966952d2..c04801774b44 100644 --- a/gfx/thebes/gfxFontconfigUtils.h +++ b/gfx/thebes/gfxFontconfigUtils.h @@ -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) diff --git a/gfx/thebes/gfxGDIFont.cpp b/gfx/thebes/gfxGDIFont.cpp index 9a2428285bea..29bfc15ab639 100644 --- a/gfx/thebes/gfxGDIFont.cpp +++ b/gfx/thebes/gfxGDIFont.cpp @@ -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); diff --git a/gfx/thebes/gfxGDIFontList.cpp b/gfx/thebes/gfxGDIFontList.cpp index 3d3046aed94f..e6d2e18dd2f2 100644 --- a/gfx/thebes/gfxGDIFontList.cpp +++ b/gfx/thebes/gfxGDIFontList.cpp @@ -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) { diff --git a/gfx/thebes/gfxGDIFontList.h b/gfx/thebes/gfxGDIFontList.h index 9fa0b03cf489..2cb63ce518b7 100644 --- a/gfx/thebes/gfxGDIFontList.h +++ b/gfx/thebes/gfxGDIFontList.h @@ -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 { diff --git a/gfx/thebes/gfxGDIShaper.cpp b/gfx/thebes/gfxGDIShaper.cpp index 7959822bdf90..9b69ac6c05e0 100644 --- a/gfx/thebes/gfxGDIShaper.cpp +++ b/gfx/thebes/gfxGDIShaper.cpp @@ -52,7 +52,7 @@ gfxGDIShaper::ShapeText(gfxContext *aContext, glyphs, length, INT_MAX, - NULL, + nullptr, partialWidthArray.Elements(), &size); if (!success) { diff --git a/gfx/thebes/gfxGdkNativeRenderer.cpp b/gfx/thebes/gfxGdkNativeRenderer.cpp index 054f746c93b7..48833a37c690 100644 --- a/gfx/thebes/gfxGdkNativeRenderer.cpp +++ b/gfx/thebes/gfxGdkNativeRenderer.cpp @@ -44,7 +44,7 @@ gfxGdkNativeRenderer::DrawWithXlib(gfxXlibSurface* surface, } return DrawWithGDK(drawable, offset.x, offset.y, - numClipRects ? &clipRect : NULL, numClipRects); + numClipRects ? &clipRect : nullptr, numClipRects); } void diff --git a/gfx/thebes/gfxImageSurface.cpp b/gfx/thebes/gfxImageSurface.cpp index d2e45b162176..c402fdc3f05f 100644 --- a/gfx/thebes/gfxImageSurface.cpp +++ b/gfx/thebes/gfxImageSurface.cpp @@ -46,7 +46,7 @@ void gfxImageSurface::MakeInvalid() { mSize = gfxIntSize(-1, -1); - mData = NULL; + mData = nullptr; mStride = 0; } diff --git a/gfx/thebes/gfxMacFont.cpp b/gfx/thebes/gfxMacFont.cpp index 0698b0554bf5..46ce79eee564 100644 --- a/gfx/thebes/gfxMacFont.cpp +++ b/gfx/thebes/gfxMacFont.cpp @@ -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; } diff --git a/gfx/thebes/gfxOS2Fonts.cpp b/gfx/thebes/gfxOS2Fonts.cpp index 39b0f1e00530..d82a4aa3ff7f 100644 --- a/gfx/thebes/gfxOS2Fonts.cpp +++ b/gfx/thebes/gfxOS2Fonts.cpp @@ -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 diff --git a/gfx/thebes/gfxOS2Surface.cpp b/gfx/thebes/gfxOS2Surface.cpp index 18098617f88a..0259479db1d3 100644 --- a/gfx/thebes/gfxOS2Surface.cpp +++ b/gfx/thebes/gfxOS2Surface.cpp @@ -149,7 +149,7 @@ gfxOS2Surface::~gfxOS2Surface() } } else { if (mBitmap) { - GpiSetBitmap(mPS, NULL); + GpiSetBitmap(mPS, nullptr); GpiDeleteBitmap(mBitmap); } if (mPS) { diff --git a/gfx/thebes/gfxPangoFonts.cpp b/gfx/thebes/gfxPangoFonts.cpp index 4e9f6fcb259d..851b38f08f7f 100644 --- a/gfx/thebes/gfxPangoFonts.cpp +++ b/gfx/thebes/gfxPangoFonts.cpp @@ -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 charset(FcFreeTypeCharSet(mFace, NULL)); + nsAutoRef 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 >& 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 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(FcFontSort(NULL, mSortPattern, - FcFalse, NULL, &result)); + return nsReturnRef(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 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()); } diff --git a/gfx/thebes/gfxPangoFonts.h b/gfx/thebes/gfxPangoFonts.h index d57d00022932..0b8073ce6765 100644 --- a/gfx/thebes/gfxPangoFonts.h +++ b/gfx/thebes/gfxPangoFonts.h @@ -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 MakeFontSet(PangoLanguage *aLang, gfxFloat aSizeAdjustFactor, - nsAutoRef *aMatchPattern = NULL); + nsAutoRef *aMatchPattern = nullptr); gfxFcFontSet *GetBaseFontSet(); gfxFcFont *GetBaseFont(); diff --git a/gfx/thebes/gfxPattern.cpp b/gfx/thebes/gfxPattern.cpp index 14accb96ccd5..7c3e5100e904 100644 --- a/gfx/thebes/gfxPattern.cpp +++ b/gfx/thebes/gfxPattern.cpp @@ -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(&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) { diff --git a/gfx/thebes/gfxPattern.h b/gfx/thebes/gfxPattern.h index 736f4751f2f1..5996e1bd81b6 100644 --- a/gfx/thebes/gfxPattern.h +++ b/gfx/thebes/gfxPattern.h @@ -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, diff --git a/gfx/thebes/gfxPlatform.cpp b/gfx/thebes/gfxPlatform.cpp index 3224e8221427..b98e30777044 100644 --- a/gfx/thebes/gfxPlatform.cpp +++ b/gfx/thebes/gfxPlatform.cpp @@ -556,7 +556,7 @@ RefPtr gfxPlatform::CreateDrawTargetForSurface(gfxASurface *aSurface, const IntSize& aSize) { RefPtr 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(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(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 surf = CreateOffscreenSurface(ThebesIntSize(aSize), ContentForFormat(aFormat)); if (!surf || surf->CairoStatus()) { - return NULL; + return nullptr; } return CreateDrawTargetForSurface(surf, aSize); diff --git a/gfx/thebes/gfxPlatform.h b/gfx/thebes/gfxPlatform.h index a44e0033dee4..b3a4c4d0a46a 100644 --- a/gfx/thebes/gfxPlatform.h +++ b/gfx/thebes/gfxPlatform.h @@ -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); diff --git a/gfx/thebes/gfxPlatformGtk.cpp b/gfx/thebes/gfxPlatformGtk.cpp index d2e3db2223f6..09da1f803c18 100644 --- a/gfx/thebes/gfxPlatformGtk.cpp +++ b/gfx/thebes/gfxPlatformGtk.cpp @@ -59,11 +59,11 @@ gfxFontconfigUtils *gfxPlatformGtk::sFontconfigUtils = nullptr; #ifndef MOZ_PANGO typedef nsDataHashtable > FontTable; typedef nsDataHashtable > > 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(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; } diff --git a/gfx/thebes/gfxPlatformMac.cpp b/gfx/thebes/gfxPlatformMac.cpp index b4db5bad8249..926cb219e7c4 100644 --- a/gfx/thebes/gfxPlatformMac.cpp +++ b/gfx/thebes/gfxPlatformMac.cpp @@ -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; diff --git a/gfx/thebes/gfxQtNativeRenderer.cpp b/gfx/thebes/gfxQtNativeRenderer.cpp index c08f388be0e1..bfc32abcd8a0 100644 --- a/gfx/thebes/gfxQtNativeRenderer.cpp +++ b/gfx/thebes/gfxQtNativeRenderer.cpp @@ -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; diff --git a/gfx/thebes/gfxQtPlatform.cpp b/gfx/thebes/gfxQtPlatform.cpp index bb9941f03a93..331f8e09ca4d 100644 --- a/gfx/thebes/gfxQtPlatform.cpp +++ b/gfx/thebes/gfxQtPlatform.cpp @@ -78,11 +78,11 @@ static gfxImageFormat sOffscreenFormat = gfxASurface::ImageFormatRGB24; #ifndef MOZ_PANGO typedef nsDataHashtable > FontTable; typedef nsDataHashtable > > 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); diff --git a/gfx/thebes/gfxQuartzImageSurface.cpp b/gfx/thebes/gfxQuartzImageSurface.cpp index 51bb0218e932..791c00bffe42 100644 --- a/gfx/thebes/gfxQuartzImageSurface.cpp +++ b/gfx/thebes/gfxQuartzImageSurface.cpp @@ -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()); diff --git a/gfx/thebes/gfxQuartzSurface.cpp b/gfx/thebes/gfxQuartzSurface.cpp index f50fa0c1e9bf..7af4dd01b3ee 100644 --- a/gfx/thebes/gfxQuartzSurface.cpp +++ b/gfx/thebes/gfxQuartzSurface.cpp @@ -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)); diff --git a/gfx/thebes/gfxUniscribeShaper.cpp b/gfx/thebes/gfxUniscribeShaper.cpp index 65d066823e88..20d7d5723c5f 100644 --- a/gfx/thebes/gfxUniscribeShaper.cpp +++ b/gfx/thebes/gfxUniscribeShaper.cpp @@ -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(); diff --git a/gfx/thebes/gfxUniscribeShaper.h b/gfx/thebes/gfxUniscribeShaper.h index c90518b6f6cd..ccf28c367521 100644 --- a/gfx/thebes/gfxUniscribeShaper.h +++ b/gfx/thebes/gfxUniscribeShaper.h @@ -19,7 +19,7 @@ class gfxUniscribeShaper : public gfxFontShaper public: gfxUniscribeShaper(gfxGDIFont *aFont) : gfxFontShaper(aFont) - , mScriptCache(NULL) + , mScriptCache(nullptr) { MOZ_COUNT_CTOR(gfxUniscribeShaper); } diff --git a/gfx/thebes/gfxUserFontSet.cpp b/gfx/thebes/gfxUserFontSet.cpp index e6674677fc5b..8bea36a7bcbe 100644 --- a/gfx/thebes/gfxUserFontSet.cpp +++ b/gfx/thebes/gfxUserFontSet.cpp @@ -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, diff --git a/gfx/thebes/gfxUtils.cpp b/gfx/thebes/gfxUtils.cpp index f1b7d2f27021..7633765fc663 100644 --- a/gfx/thebes/gfxUtils.cpp +++ b/gfx/thebes/gfxUtils.cpp @@ -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 diff --git a/gfx/thebes/gfxWindowsNativeDrawing.cpp b/gfx/thebes/gfxWindowsNativeDrawing.cpp index 199e19322468..5c62a0a218e1 100644 --- a/gfx/thebes/gfxWindowsNativeDrawing.cpp +++ b/gfx/thebes/gfxWindowsNativeDrawing.cpp @@ -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); diff --git a/gfx/thebes/gfxWindowsPlatform.cpp b/gfx/thebes/gfxWindowsPlatform.cpp index 3be242a3483d..ffe48f4e56f7 100644 --- a/gfx/thebes/gfxWindowsPlatform.cpp +++ b/gfx/thebes/gfxWindowsPlatform.cpp @@ -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 &adapter1, nsRefPtr 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(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 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 versionInfo; if (versInfoSize == 0 || @@ -1231,7 +1231,8 @@ gfxWindowsPlatform::GetCleartypeParams(nsTArray& 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& 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& 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& 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& 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); diff --git a/gfx/thebes/gfxWindowsPlatform.h b/gfx/thebes/gfxWindowsPlatform.h index 8443d2478a25..3d8ab0e28347 100644 --- a/gfx/thebes/gfxWindowsPlatform.h +++ b/gfx/thebes/gfxWindowsPlatform.h @@ -52,7 +52,7 @@ class nsIMemoryMultiReporter; // used by both GDI and Uniscribe font shapers struct DCFromContext { DCFromContext(gfxContext *aContext) { - dc = NULL; + dc = nullptr; nsRefPtr 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); } diff --git a/gfx/thebes/gfxWindowsSurface.cpp b/gfx/thebes/gfxWindowsSurface.cpp index 43942d4a0889..0fe3ee969f88 100644 --- a/gfx/thebes/gfxWindowsSurface.cpp +++ b/gfx/thebes/gfxWindowsSurface.cpp @@ -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); diff --git a/gfx/thebes/gfxWindowsSurface.h b/gfx/thebes/gfxWindowsSurface.h index cb783b765ef5..1e8cc92627f9 100644 --- a/gfx/thebes/gfxWindowsSurface.h +++ b/gfx/thebes/gfxWindowsSurface.h @@ -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); diff --git a/gfx/thebes/gfxXlibNativeRenderer.cpp b/gfx/thebes/gfxXlibNativeRenderer.cpp index 84a566d2f89e..d71b435e068a 100644 --- a/gfx/thebes/gfxXlibNativeRenderer.cpp +++ b/gfx/thebes/gfxXlibNativeRenderer.cpp @@ -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 tmpCtx; diff --git a/gfx/thebes/gfxXlibSurface.cpp b/gfx/thebes/gfxXlibSurface.cpp index 712d76d71c6a..6e0f1133e6dd 100644 --- a/gfx/thebes/gfxXlibSurface.cpp +++ b/gfx/thebes/gfxXlibSurface.cpp @@ -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* diff --git a/gfx/thebes/nsSurfaceTexture.cpp b/gfx/thebes/nsSurfaceTexture.cpp index a263f9752e34..f48cdab4696d 100644 --- a/gfx/thebes/nsSurfaceTexture.cpp +++ b/gfx/thebes/nsSurfaceTexture.cpp @@ -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; } }