diff options
author | halcanary <halcanary@google.com> | 2015-08-27 07:41:13 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-08-27 07:41:16 -0700 |
commit | 96fcdcc219d2a0d3579719b84b28bede76efba64 (patch) | |
tree | 0ec5ea0193d8292df8bf5ed9dd8498a5eb5763dd /src/utils/win | |
parent | 435af2f736c85c3274a0c6760a3523810750d237 (diff) |
Style Change: NULL->nullptr
DOCS_PREVIEW= https://skia.org/?cl=1316233002
Review URL: https://codereview.chromium.org/1316233002
Diffstat (limited to 'src/utils/win')
-rw-r--r-- | src/utils/win/SkAutoCoInitialize.cpp | 2 | ||||
-rw-r--r-- | src/utils/win/SkDWrite.cpp | 8 | ||||
-rw-r--r-- | src/utils/win/SkDWriteFontFileStream.cpp | 20 | ||||
-rw-r--r-- | src/utils/win/SkDWriteGeometrySink.cpp | 4 | ||||
-rw-r--r-- | src/utils/win/SkHRESULT.cpp | 10 | ||||
-rw-r--r-- | src/utils/win/SkIStream.cpp | 10 | ||||
-rw-r--r-- | src/utils/win/SkWGL_win.cpp | 66 |
7 files changed, 60 insertions, 60 deletions
diff --git a/src/utils/win/SkAutoCoInitialize.cpp b/src/utils/win/SkAutoCoInitialize.cpp index 89115bfe41..78326a5608 100644 --- a/src/utils/win/SkAutoCoInitialize.cpp +++ b/src/utils/win/SkAutoCoInitialize.cpp @@ -14,7 +14,7 @@ SkAutoCoInitialize::SkAutoCoInitialize() : fHR( - CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE) + CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE) ) { } diff --git a/src/utils/win/SkDWrite.cpp b/src/utils/win/SkDWrite.cpp index 363ac438d9..2254961d14 100644 --- a/src/utils/win/SkDWrite.cpp +++ b/src/utils/win/SkDWrite.cpp @@ -12,7 +12,7 @@ #include <dwrite.h> -static IDWriteFactory* gDWriteFactory = NULL; +static IDWriteFactory* gDWriteFactory = nullptr; static void release_dwrite_factory() { if (gDWriteFactory) { @@ -52,7 +52,7 @@ IDWriteFactory* sk_get_dwrite_factory() { /** Converts a utf8 string to a WCHAR string. */ HRESULT sk_cstring_to_wchar(const char* skname, SkSMallocWCHAR* name) { - int wlen = MultiByteToWideChar(CP_UTF8, 0, skname, -1, NULL, 0); + int wlen = MultiByteToWideChar(CP_UTF8, 0, skname, -1, nullptr, 0); if (0 == wlen) { HRM(HRESULT_FROM_WIN32(GetLastError()), "Could not get length for wchar to utf-8 conversion."); @@ -67,7 +67,7 @@ HRESULT sk_cstring_to_wchar(const char* skname, SkSMallocWCHAR* name) { /** Converts a WCHAR string to a utf8 string. */ HRESULT sk_wchar_to_skstring(WCHAR* name, int nameLen, SkString* skname) { - int len = WideCharToMultiByte(CP_UTF8, 0, name, nameLen, NULL, 0, NULL, NULL); + int len = WideCharToMultiByte(CP_UTF8, 0, name, nameLen, nullptr, 0, nullptr, nullptr); if (0 == len) { if (nameLen <= 0) { skname->reset(); @@ -78,7 +78,7 @@ HRESULT sk_wchar_to_skstring(WCHAR* name, int nameLen, SkString* skname) { } skname->resize(len); - len = WideCharToMultiByte(CP_UTF8, 0, name, nameLen, skname->writable_str(), len, NULL, NULL); + len = WideCharToMultiByte(CP_UTF8, 0, name, nameLen, skname->writable_str(), len, nullptr, nullptr); if (0 == len) { HRM(HRESULT_FROM_WIN32(GetLastError()), "Could not convert utf-8 to wchar."); } diff --git a/src/utils/win/SkDWriteFontFileStream.cpp b/src/utils/win/SkDWriteFontFileStream.cpp index eb7e5dccaf..0e3d4fc202 100644 --- a/src/utils/win/SkDWriteFontFileStream.cpp +++ b/src/utils/win/SkDWriteFontFileStream.cpp @@ -20,8 +20,8 @@ SkDWriteFontFileStream::SkDWriteFontFileStream(IDWriteFontFileStream* fontFileStream) : fFontFileStream(SkRefComPtr(fontFileStream)) , fPos(0) - , fLockedMemory(NULL) - , fFragmentLock(NULL) { + , fLockedMemory(nullptr) + , fFragmentLock(nullptr) { } SkDWriteFontFileStream::~SkDWriteFontFileStream() { @@ -33,7 +33,7 @@ SkDWriteFontFileStream::~SkDWriteFontFileStream() { size_t SkDWriteFontFileStream::read(void* buffer, size_t size) { HRESULT hr = S_OK; - if (NULL == buffer) { + if (nullptr == buffer) { size_t fileSize = this->getLength(); if (fPos + size > fileSize) { @@ -137,7 +137,7 @@ HRESULT SkDWriteFontFileStreamWrapper::Create(SkStreamAsset* stream, SkDWriteFontFileStreamWrapper** streamFontFileStream) { *streamFontFileStream = new SkDWriteFontFileStreamWrapper(stream); - if (NULL == streamFontFileStream) { + if (nullptr == streamFontFileStream) { return E_OUTOFMEMORY; } return S_OK; @@ -153,7 +153,7 @@ HRESULT STDMETHODCALLTYPE SkDWriteFontFileStreamWrapper::QueryInterface(REFIID i AddRef(); return S_OK; } else { - *ppvObject = NULL; + *ppvObject = nullptr; return E_NOINTERFACE; } } @@ -180,8 +180,8 @@ HRESULT STDMETHODCALLTYPE SkDWriteFontFileStreamWrapper::ReadFileFragment( UINT64 fileSize; this->GetFileSize(&fileSize); if (fileOffset > fileSize || fragmentSize > fileSize - fileOffset) { - *fragmentStart = NULL; - *fragmentContext = NULL; + *fragmentStart = nullptr; + *fragmentContext = nullptr; return E_FAIL; } @@ -192,14 +192,14 @@ HRESULT STDMETHODCALLTYPE SkDWriteFontFileStreamWrapper::ReadFileFragment( const void* data = fStream->getMemoryBase(); if (data) { *fragmentStart = static_cast<BYTE const*>(data) + static_cast<size_t>(fileOffset); - *fragmentContext = NULL; + *fragmentContext = nullptr; } else { // May be called from multiple threads. SkAutoMutexAcquire ama(fStreamMutex); - *fragmentStart = NULL; - *fragmentContext = NULL; + *fragmentStart = nullptr; + *fragmentContext = nullptr; if (!fStream->seek(static_cast<size_t>(fileOffset))) { return E_FAIL; diff --git a/src/utils/win/SkDWriteGeometrySink.cpp b/src/utils/win/SkDWriteGeometrySink.cpp index b7ef88ba3b..066d4a4674 100644 --- a/src/utils/win/SkDWriteGeometrySink.cpp +++ b/src/utils/win/SkDWriteGeometrySink.cpp @@ -19,7 +19,7 @@ SkDWriteGeometrySink::SkDWriteGeometrySink(SkPath* path) : fRefCount(1), fPath(p SkDWriteGeometrySink::~SkDWriteGeometrySink() { } HRESULT STDMETHODCALLTYPE SkDWriteGeometrySink::QueryInterface(REFIID iid, void **object) { - if (NULL == object) { + if (nullptr == object) { return E_INVALIDARG; } if (iid == __uuidof(IUnknown) || iid == __uuidof(IDWriteGeometrySink)) { @@ -27,7 +27,7 @@ HRESULT STDMETHODCALLTYPE SkDWriteGeometrySink::QueryInterface(REFIID iid, void this->AddRef(); return S_OK; } else { - *object = NULL; + *object = nullptr; return E_NOINTERFACE; } } diff --git a/src/utils/win/SkHRESULT.cpp b/src/utils/win/SkHRESULT.cpp index 0aea4a622e..d565986d10 100644 --- a/src/utils/win/SkHRESULT.cpp +++ b/src/utils/win/SkHRESULT.cpp @@ -15,23 +15,23 @@ void SkTraceHR(const char* file, unsigned long line, HRESULT hr, const char* msg } SkDebugf("%s(%lu) : error 0x%x: ", file, line, hr); - LPSTR errorText = NULL; + LPSTR errorText = nullptr; FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, + nullptr, hr, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPSTR) &errorText, 0, - NULL + nullptr ); - if (NULL == errorText) { + if (nullptr == errorText) { SkDebugf("<unknown>\n"); } else { SkDebugf("%s", errorText); LocalFree(errorText); - errorText = NULL; + errorText = nullptr; } } diff --git a/src/utils/win/SkIStream.cpp b/src/utils/win/SkIStream.cpp index dc9d1636d7..f1dbcb274c 100644 --- a/src/utils/win/SkIStream.cpp +++ b/src/utils/win/SkIStream.cpp @@ -22,7 +22,7 @@ SkBaseIStream::~SkBaseIStream() { } HRESULT STDMETHODCALLTYPE SkBaseIStream::QueryInterface(REFIID iid , void ** ppvObject) { - if (NULL == ppvObject) { + if (nullptr == ppvObject) { return E_INVALIDARG; } if (iid == __uuidof(IUnknown) @@ -33,7 +33,7 @@ HRESULT STDMETHODCALLTYPE SkBaseIStream::QueryInterface(REFIID iid AddRef(); return S_OK; } else { - *ppvObject = NULL; + *ppvObject = nullptr; return E_NOINTERFACE; } } @@ -122,7 +122,7 @@ HRESULT SkIStream::CreateFromSkStream(SkStream* stream , bool deleteOnRelease , IStream ** ppStream) { - if (NULL == stream) { + if (nullptr == stream) { return E_INVALIDARG; } *ppStream = new SkIStream(stream, deleteOnRelease); @@ -208,7 +208,7 @@ HRESULT STDMETHODCALLTYPE SkIStream::Stat(STATSTG* pStatstg if (0 == (grfStatFlag & STATFLAG_NONAME)) { return STG_E_INVALIDFLAG; } - pStatstg->pwcsName = NULL; + pStatstg->pwcsName = nullptr; // FIXME: Should not depend on getLength // See https://code.google.com/p/skia/issues/detail?id=1570 pStatstg->cbSize.QuadPart = this->fSkStream->getLength(); @@ -268,7 +268,7 @@ HRESULT STDMETHODCALLTYPE SkWIStream::Stat(STATSTG* pStatstg if (0 == (grfStatFlag & STATFLAG_NONAME)) { return STG_E_INVALIDFLAG; } - pStatstg->pwcsName = NULL; + pStatstg->pwcsName = nullptr; pStatstg->cbSize.QuadPart = 0; pStatstg->clsid = CLSID_NULL; pStatstg->type = STGTY_STREAM; diff --git a/src/utils/win/SkWGL_win.cpp b/src/utils/win/SkWGL_win.cpp index 60f3cb34a4..ef07bea61e 100644 --- a/src/utils/win/SkWGL_win.cpp +++ b/src/utils/win/SkWGL_win.cpp @@ -13,7 +13,7 @@ #include "SkTSort.h" bool SkWGLExtensions::hasExtension(HDC dc, const char* ext) const { - if (NULL == this->fGetExtensionsString) { + if (nullptr == this->fGetExtensionsString) { return false; } if (!strcmp("WGL_ARB_extensions_string", ext)) { @@ -168,7 +168,7 @@ namespace { #define DUMMY_CLASS STR_LIT("DummyClass") HWND create_dummy_window() { - HMODULE module = GetModuleHandle(NULL); + HMODULE module = GetModuleHandle(nullptr); HWND dummy; RECT windowRect; windowRect.left = 0; @@ -183,10 +183,10 @@ HWND create_dummy_window() { wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = module; - wc.hIcon = LoadIcon(NULL, IDI_WINLOGO); - wc.hCursor = LoadCursor(NULL, IDC_ARROW); - wc.hbrBackground = NULL; - wc.lpszMenuName = NULL; + wc.hIcon = LoadIcon(nullptr, IDI_WINLOGO); + wc.hCursor = LoadCursor(nullptr, IDC_ARROW); + wc.hbrBackground = nullptr; + wc.lpszMenuName = nullptr; wc.lpszClassName = DUMMY_CLASS; if(!RegisterClass(&wc)) { @@ -205,11 +205,11 @@ HWND create_dummy_window() { 0, 0, windowRect.right-windowRect.left, windowRect.bottom-windowRect.top, - NULL, NULL, + nullptr, nullptr, module, - NULL))) { + nullptr))) { UnregisterClass(DUMMY_CLASS, module); - return NULL; + return nullptr; } ShowWindow(dummy, SW_HIDE); @@ -218,7 +218,7 @@ HWND create_dummy_window() { void destroy_dummy_window(HWND dummy) { DestroyWindow(dummy); - HMODULE module = GetModuleHandle(NULL); + HMODULE module = GetModuleHandle(nullptr); UnregisterClass(DUMMY_CLASS, module); } } @@ -227,16 +227,16 @@ void destroy_dummy_window(HWND dummy) { (##NAME##Proc) wglGetProcAddress("wgl" #NAME #SUFFIX) SkWGLExtensions::SkWGLExtensions() - : fGetExtensionsString(NULL) - , fChoosePixelFormat(NULL) - , fGetPixelFormatAttribfv(NULL) - , fGetPixelFormatAttribiv(NULL) - , fCreateContextAttribs(NULL) - , fSwapInterval(NULL) - , fCreatePbuffer(NULL) - , fGetPbufferDC(NULL) - , fReleasePbufferDC(NULL) - , fDestroyPbuffer(NULL) + : fGetExtensionsString(nullptr) + , fChoosePixelFormat(nullptr) + , fGetPixelFormatAttribfv(nullptr) + , fGetPixelFormatAttribiv(nullptr) + , fCreateContextAttribs(nullptr) + , fSwapInterval(nullptr) + , fCreatePbuffer(nullptr) + , fGetPbufferDC(nullptr) + , fReleasePbufferDC(nullptr) + , fDestroyPbuffer(nullptr) { HDC prevDC = wglGetCurrentDC(); HGLRC prevGLRC = wglGetCurrentContext(); @@ -272,7 +272,7 @@ SkWGLExtensions::SkWGLExtensions() GET_PROC(ReleasePbufferDC, ARB); GET_PROC(DestroyPbuffer, ARB); - wglMakeCurrent(dummyDC, NULL); + wglMakeCurrent(dummyDC, nullptr); wglDeleteContext(dummyGLRC); destroy_dummy_window(dummyWND); } @@ -329,11 +329,11 @@ static HGLRC create_gl_context(HDC dc, SkWGLExtensions extensions, SkWGLContextR HDC prevDC = wglGetCurrentDC(); HGLRC prevGLRC = wglGetCurrentContext(); - HGLRC glrc = NULL; + HGLRC glrc = nullptr; if (kGLES_SkWGLContextRequest == contextType) { if (!extensions.hasExtension(dc, "WGL_EXT_create_context_es2_profile")) { wglMakeCurrent(prevDC, prevGLRC); - return NULL; + return nullptr; } static const int glesAttribs[] = { SK_WGL_CONTEXT_MAJOR_VERSION, 3, @@ -341,10 +341,10 @@ static HGLRC create_gl_context(HDC dc, SkWGLExtensions extensions, SkWGLContextR SK_WGL_CONTEXT_PROFILE_MASK, SK_WGL_CONTEXT_ES2_PROFILE_BIT, 0, }; - glrc = extensions.createContextAttribs(dc, NULL, glesAttribs); - if (NULL == glrc) { + glrc = extensions.createContextAttribs(dc, nullptr, glesAttribs); + if (nullptr == glrc) { wglMakeCurrent(prevDC, prevGLRC); - return NULL; + return nullptr; } } else { if (kGLPreferCoreProfile_SkWGLContextRequest == contextType && @@ -366,7 +366,7 @@ static HGLRC create_gl_context(HDC dc, SkWGLExtensions extensions, SkWGLContextR for (int v = 0; v < SK_ARRAY_COUNT(kCoreGLVersions) / 2; ++v) { coreProfileAttribs[1] = kCoreGLVersions[2 * v]; coreProfileAttribs[3] = kCoreGLVersions[2 * v + 1]; - glrc = extensions.createContextAttribs(dc, NULL, coreProfileAttribs); + glrc = extensions.createContextAttribs(dc, nullptr, coreProfileAttribs); if (glrc) { break; } @@ -374,7 +374,7 @@ static HGLRC create_gl_context(HDC dc, SkWGLExtensions extensions, SkWGLContextR } } - if (NULL == glrc) { + if (nullptr == glrc) { glrc = wglCreateContext(dc); } SkASSERT(glrc); @@ -391,7 +391,7 @@ static HGLRC create_gl_context(HDC dc, SkWGLExtensions extensions, SkWGLContextR HGLRC SkCreateWGLContext(HDC dc, int msaaSampleCount, SkWGLContextRequest contextType) { SkWGLExtensions extensions; if (!extensions.hasExtension(dc, "WGL_ARB_pixel_format")) { - return NULL; + return nullptr; } BOOL set = FALSE; @@ -407,7 +407,7 @@ HGLRC SkCreateWGLContext(HDC dc, int msaaSampleCount, SkWGLContextRequest contex } if (!set) { - return NULL; + return nullptr; } return create_gl_context(dc, extensions, contextType);} @@ -417,7 +417,7 @@ SkWGLPbufferContext* SkWGLPbufferContext::Create(HDC parentDC, int msaaSampleCou SkWGLExtensions extensions; if (!extensions.hasExtension(parentDC, "WGL_ARB_pixel_format") || !extensions.hasExtension(parentDC, "WGL_ARB_pbuffer")) { - return NULL; + return nullptr; } // try for single buffer first @@ -426,7 +426,7 @@ SkWGLPbufferContext* SkWGLPbufferContext::Create(HDC parentDC, int msaaSampleCou get_pixel_formats_to_try(parentDC, extensions, (0 != dblBuffer), msaaSampleCount, pixelFormatsToTry); for (int f = 0; -1 != pixelFormatsToTry[f] && f < SK_ARRAY_COUNT(pixelFormatsToTry); ++f) { - HPBUFFER pbuf = extensions.createPbuffer(parentDC, pixelFormatsToTry[f], 1, 1, NULL); + HPBUFFER pbuf = extensions.createPbuffer(parentDC, pixelFormatsToTry[f], 1, 1, nullptr); if (0 != pbuf) { HDC dc = extensions.getPbufferDC(pbuf); if (dc) { @@ -440,7 +440,7 @@ SkWGLPbufferContext* SkWGLPbufferContext::Create(HDC parentDC, int msaaSampleCou } } } - return NULL; + return nullptr; } SkWGLPbufferContext::~SkWGLPbufferContext() { |