[opengl] Modernize codebase by replacing NULL with nullptr
Fixes -Wzero-as-null-pointer-constant warning.
Test: m
Bug: 68236239
Change-Id: Ia2f91707b277954d5105f6fdb489caad9ef8848c
diff --git a/opengl/libs/EGL/BlobCache.cpp b/opengl/libs/EGL/BlobCache.cpp
index b3752f5..74c4d7d 100644
--- a/opengl/libs/EGL/BlobCache.cpp
+++ b/opengl/libs/EGL/BlobCache.cpp
@@ -79,7 +79,7 @@
}
std::shared_ptr<Blob> dummyKey(new Blob(key, keySize, false));
- CacheEntry dummyEntry(dummyKey, NULL);
+ CacheEntry dummyEntry(dummyKey, nullptr);
while (true) {
auto index = std::lower_bound(mCacheEntries.begin(), mCacheEntries.end(), dummyEntry);
@@ -139,7 +139,7 @@
return 0;
}
std::shared_ptr<Blob> dummyKey(new Blob(key, keySize, false));
- CacheEntry dummyEntry(dummyKey, NULL);
+ CacheEntry dummyEntry(dummyKey, nullptr);
auto index = std::lower_bound(mCacheEntries.begin(), mCacheEntries.end(), dummyEntry);
if (index == mCacheEntries.end() || dummyEntry < *index) {
ALOGV("get: no cache entry found for key of size %zu", keySize);
@@ -308,7 +308,7 @@
mData(copyData ? malloc(size) : data),
mSize(size),
mOwnsData(copyData) {
- if (data != NULL && copyData) {
+ if (data != nullptr && copyData) {
memcpy(const_cast<void*>(mData), data, size);
}
}
diff --git a/opengl/libs/EGL/BlobCache_test.cpp b/opengl/libs/EGL/BlobCache_test.cpp
index edbaaf0..cf67cf4 100644
--- a/opengl/libs/EGL/BlobCache_test.cpp
+++ b/opengl/libs/EGL/BlobCache_test.cpp
@@ -97,7 +97,7 @@
TEST_F(BlobCacheTest, GetDoesntAccessNullBuffer) {
mBC->set("abcd", 4, "efgh", 4);
- ASSERT_EQ(size_t(4), mBC->get("abcd", 4, NULL, 0));
+ ASSERT_EQ(size_t(4), mBC->get("abcd", 4, nullptr, 0));
}
TEST_F(BlobCacheTest, MultipleSetsCacheLatestValue) {
@@ -169,7 +169,7 @@
}
mBC->set(key, MAX_KEY_SIZE, buf, MAX_VALUE_SIZE);
- ASSERT_EQ(size_t(0), mBC->get(key, MAX_KEY_SIZE, NULL, 0));
+ ASSERT_EQ(size_t(0), mBC->get(key, MAX_KEY_SIZE, nullptr, 0));
}
TEST_F(BlobCacheTest, CacheMaxKeySizeSucceeds) {
@@ -219,7 +219,7 @@
}
mBC->set(key, MAX_KEY_SIZE, buf, bufSize);
- ASSERT_EQ(size_t(bufSize), mBC->get(key, MAX_KEY_SIZE, NULL, 0));
+ ASSERT_EQ(size_t(bufSize), mBC->get(key, MAX_KEY_SIZE, nullptr, 0));
}
TEST_F(BlobCacheTest, CacheMinKeyAndValueSizeSucceeds) {
@@ -237,7 +237,7 @@
int numCached = 0;
for (int i = 0; i < 256; i++) {
uint8_t k = i;
- if (mBC->get(&k, 1, NULL, 0) == 1) {
+ if (mBC->get(&k, 1, nullptr, 0) == 1) {
numCached++;
}
}
@@ -260,7 +260,7 @@
int numCached = 0;
for (int i = 0; i < maxEntries+1; i++) {
uint8_t k = i;
- if (mBC->get(&k, 1, NULL, 0) == 1) {
+ if (mBC->get(&k, 1, nullptr, 0) == 1) {
numCached++;
}
}
diff --git a/opengl/libs/EGL/FileBlobCache.cpp b/opengl/libs/EGL/FileBlobCache.cpp
index 7923715..cc42ac7 100644
--- a/opengl/libs/EGL/FileBlobCache.cpp
+++ b/opengl/libs/EGL/FileBlobCache.cpp
@@ -77,7 +77,7 @@
return;
}
- uint8_t* buf = reinterpret_cast<uint8_t*>(mmap(NULL, fileSize,
+ uint8_t* buf = reinterpret_cast<uint8_t*>(mmap(nullptr, fileSize,
PROT_READ, MAP_PRIVATE, fd, 0));
if (buf == MAP_FAILED) {
ALOGE("error mmaping cache file: %s (%d)", strerror(errno),
diff --git a/opengl/libs/EGL/Loader.cpp b/opengl/libs/EGL/Loader.cpp
index 91a3455..e954b4f 100644
--- a/opengl/libs/EGL/Loader.cpp
+++ b/opengl/libs/EGL/Loader.cpp
@@ -129,7 +129,7 @@
{
dso[0] = gles;
for (size_t i=1 ; i<NELEM(dso) ; i++)
- dso[i] = 0;
+ dso[i] = nullptr;
}
Loader::driver_t::~driver_t()
@@ -137,7 +137,7 @@
for (size_t i=0 ; i<NELEM(dso) ; i++) {
if (dso[i]) {
dlclose(dso[i]);
- dso[i] = 0;
+ dso[i] = nullptr;
}
}
}
@@ -163,7 +163,7 @@
// ----------------------------------------------------------------------------
Loader::Loader()
- : getProcAddress(NULL)
+ : getProcAddress(nullptr)
{
}
@@ -221,7 +221,7 @@
ATRACE_CALL();
void* dso;
- driver_t* hnd = 0;
+ driver_t* hnd = nullptr;
setEmulatorGlesValue();
@@ -272,11 +272,11 @@
char const * name = *api;
__eglMustCastToProperFunctionPointerType f =
(__eglMustCastToProperFunctionPointerType)dlsym(dso, name);
- if (f == NULL) {
+ if (f == nullptr) {
// couldn't find the entry-point, use eglGetProcAddress()
f = getProcAddress(name);
}
- if (f == NULL) {
+ if (f == nullptr) {
// Try without the OES postfix
ssize_t index = ssize_t(strlen(name)) - 3;
if ((index>0 && (index<SIZE-1)) && (!strcmp(name+index, "OES"))) {
@@ -286,7 +286,7 @@
//ALOGD_IF(f, "found <%s> instead", scrap);
}
}
- if (f == NULL) {
+ if (f == nullptr) {
// Try with the OES postfix
ssize_t index = ssize_t(strlen(name)) - 3;
if (index>0 && strcmp(name+index, "OES")) {
@@ -295,7 +295,7 @@
//ALOGD_IF(f, "found <%s> instead", scrap);
}
}
- if (f == NULL) {
+ if (f == nullptr) {
//ALOGD("%s", name);
f = (__eglMustCastToProperFunctionPointerType)gl_unimplemented;
@@ -406,9 +406,9 @@
}
DIR* d = opendir(search);
- if (d != NULL) {
+ if (d != nullptr) {
struct dirent* e;
- while ((e = readdir(d)) != NULL) {
+ while ((e = readdir(d)) != nullptr) {
if (e->d_type == DT_DIR) {
continue;
}
@@ -434,7 +434,7 @@
std::string absolutePath = MatchFile::find(kind);
if (absolutePath.empty()) {
// this happens often, we don't want to log an error
- return 0;
+ return nullptr;
}
const char* const driver_absolute_path = absolutePath.c_str();
@@ -444,10 +444,10 @@
// sphal namespace.
void* dso = do_android_load_sphal_library(driver_absolute_path,
RTLD_NOW | RTLD_LOCAL);
- if (dso == 0) {
+ if (dso == nullptr) {
const char* err = dlerror();
ALOGE("load_driver(%s): %s", driver_absolute_path, err ? err : "unknown");
- return 0;
+ return nullptr;
}
ALOGD("loaded %s", driver_absolute_path);
@@ -495,7 +495,7 @@
if (!dso) {
dso = load_system_driver(kind);
if (!dso)
- return NULL;
+ return nullptr;
}
if (mask & EGL) {
@@ -512,11 +512,11 @@
char const * name = *api;
__eglMustCastToProperFunctionPointerType f =
(__eglMustCastToProperFunctionPointerType)dlsym(dso, name);
- if (f == NULL) {
+ if (f == nullptr) {
// couldn't find the entry-point, use eglGetProcAddress()
f = getProcAddress(name);
- if (f == NULL) {
- f = (__eglMustCastToProperFunctionPointerType)0;
+ if (f == nullptr) {
+ f = (__eglMustCastToProperFunctionPointerType)nullptr;
}
}
*curr++ = f;
diff --git a/opengl/libs/EGL/egl.cpp b/opengl/libs/EGL/egl.cpp
index f53cf3f..e292b80 100644
--- a/opengl/libs/EGL/egl.cpp
+++ b/opengl/libs/EGL/egl.cpp
@@ -89,22 +89,22 @@
egl_display_ptr validate_display(EGLDisplay dpy) {
egl_display_ptr dp = get_display(dpy);
if (!dp)
- return setError(EGL_BAD_DISPLAY, egl_display_ptr(NULL));
+ return setError(EGL_BAD_DISPLAY, egl_display_ptr(nullptr));
if (!dp->isReady())
- return setError(EGL_NOT_INITIALIZED, egl_display_ptr(NULL));
+ return setError(EGL_NOT_INITIALIZED, egl_display_ptr(nullptr));
return dp;
}
egl_display_ptr validate_display_connection(EGLDisplay dpy,
egl_connection_t*& cnx) {
- cnx = NULL;
+ cnx = nullptr;
egl_display_ptr dp = validate_display(dpy);
if (!dp)
return dp;
cnx = &gEGLImpl;
- if (cnx->dso == 0) {
- return setError(EGL_BAD_CONFIG, egl_display_ptr(NULL));
+ if (cnx->dso == nullptr) {
+ return setError(EGL_BAD_CONFIG, egl_display_ptr(nullptr));
}
return dp;
}
@@ -117,14 +117,14 @@
EGLContext context = egl_tls_t::getContext();
if (context == EGL_NO_CONTEXT)
- return NULL;
+ return nullptr;
egl_context_t const * const c = get_context(context);
- if (c == NULL) // this should never happen, by construction
- return NULL;
+ if (c == nullptr) // this should never happen, by construction
+ return nullptr;
if (name != GL_EXTENSIONS)
- return NULL;
+ return nullptr;
return (const GLubyte *)c->gl_extensions.c_str();
}
@@ -135,19 +135,19 @@
EGLContext context = egl_tls_t::getContext();
if (context == EGL_NO_CONTEXT)
- return NULL;
+ return nullptr;
egl_context_t const * const c = get_context(context);
- if (c == NULL) // this should never happen, by construction
- return NULL;
+ if (c == nullptr) // this should never happen, by construction
+ return nullptr;
if (name != GL_EXTENSIONS)
- return NULL;
+ return nullptr;
// if index is out of bounds, assume it will be in the default
// implementation too, so we don't have to generate a GL error here
if (index >= c->tokenized_gl_extensions.size())
- return NULL;
+ return nullptr;
return (const GLubyte *)c->tokenized_gl_extensions[index].c_str();
}
@@ -161,7 +161,7 @@
return -1;
egl_context_t const * const c = get_context(context);
- if (c == NULL) // this should never happen, by construction
+ if (c == nullptr) // this should never happen, by construction
return -1;
return (GLint)c->tokenized_gl_extensions.size();
@@ -184,7 +184,7 @@
// dynamically load our EGL implementation
egl_connection_t* cnx = &gEGLImpl;
- if (cnx->dso == 0) {
+ if (cnx->dso == nullptr) {
cnx->hooks[egl_connection_t::GLESv1_INDEX] =
&gHooks[egl_connection_t::GLESv1_INDEX];
cnx->hooks[egl_connection_t::GLESv2_INDEX] =
@@ -249,12 +249,12 @@
char const * const gl_names[] = {
#include "../entries.in"
- NULL
+ nullptr
};
char const * const egl_names[] = {
#include "egl_entries.in"
- NULL
+ nullptr
};
#undef GL_ENTRY
diff --git a/opengl/libs/EGL/eglApi.cpp b/opengl/libs/EGL/eglApi.cpp
index f73967c..86430b0 100644
--- a/opengl/libs/EGL/eglApi.cpp
+++ b/opengl/libs/EGL/eglApi.cpp
@@ -257,7 +257,7 @@
return map[i].address;
}
}
- return NULL;
+ return nullptr;
}
// ----------------------------------------------------------------------------
@@ -340,7 +340,7 @@
const egl_display_ptr dp = validate_display(dpy);
if (!dp) return EGL_FALSE;
- if (num_config==0) {
+ if (num_config==nullptr) {
return setError(EGL_BAD_PARAMETER, (EGLBoolean)EGL_FALSE);
}
@@ -365,7 +365,7 @@
const egl_display_ptr dp = validate_display(dpy);
if (!dp) return EGL_FALSE;
- if (num_config==0) {
+ if (num_config==nullptr) {
return setError(EGL_BAD_PARAMETER, (EGLBoolean)EGL_FALSE);
}
@@ -384,8 +384,8 @@
// Only enable MSAA if the context is OpenGL ES 2.0 and
// if no caveat is requested
- const EGLint *attribRendererable = NULL;
- const EGLint *attribCaveat = NULL;
+ const EGLint *attribRendererable = nullptr;
+ const EGLint *attribCaveat = nullptr;
// Count the number of attributes and look for
// EGL_RENDERABLE_TYPE and EGL_CONFIG_CAVEAT
@@ -440,7 +440,7 @@
{
clearError();
- egl_connection_t* cnx = NULL;
+ egl_connection_t* cnx = nullptr;
const egl_display_ptr dp = validate_display_connection(dpy, cnx);
if (!dp) return EGL_FALSE;
@@ -698,7 +698,7 @@
const EGLint *origAttribList = attrib_list;
clearError();
- egl_connection_t* cnx = NULL;
+ egl_connection_t* cnx = nullptr;
egl_display_ptr dp = validate_display_connection(dpy, cnx);
if (dp) {
if (!window) {
@@ -781,7 +781,7 @@
{
clearError();
- egl_connection_t* cnx = NULL;
+ egl_connection_t* cnx = nullptr;
egl_display_ptr dp = validate_display_connection(dpy, cnx);
if (dp) {
EGLDisplay iDpy = dp->disp.dpy;
@@ -802,7 +802,7 @@
dp->disp.dpy, config, pixmap, attrib_list);
if (surface != EGL_NO_SURFACE) {
egl_surface_t* s =
- new egl_surface_t(dp.get(), config, NULL, surface,
+ new egl_surface_t(dp.get(), config, nullptr, surface,
getReportedColorSpace(colorSpace), cnx);
return s;
}
@@ -815,7 +815,7 @@
{
clearError();
- egl_connection_t* cnx = NULL;
+ egl_connection_t* cnx = nullptr;
egl_display_ptr dp = validate_display_connection(dpy, cnx);
if (dp) {
EGLDisplay iDpy = dp->disp.dpy;
@@ -836,7 +836,7 @@
dp->disp.dpy, config, attrib_list);
if (surface != EGL_NO_SURFACE) {
egl_surface_t* s =
- new egl_surface_t(dp.get(), config, NULL, surface,
+ new egl_surface_t(dp.get(), config, nullptr, surface,
getReportedColorSpace(colorSpace), cnx);
return s;
}
@@ -910,7 +910,7 @@
{
clearError();
- egl_connection_t* cnx = NULL;
+ egl_connection_t* cnx = nullptr;
const egl_display_ptr dp = validate_display_connection(dpy, cnx);
if (dp) {
if (share_list != EGL_NO_CONTEXT) {
@@ -999,9 +999,9 @@
EGLSurface impl_read = EGL_NO_SURFACE;
// these are our objects structs passed in
- egl_context_t * c = NULL;
- egl_surface_t const * d = NULL;
- egl_surface_t const * r = NULL;
+ egl_context_t * c = nullptr;
+ egl_surface_t const * d = nullptr;
+ egl_surface_t const * r = nullptr;
// these are the current objects structs
egl_context_t * cur_c = get_context(getContext());
@@ -1015,7 +1015,7 @@
// calling eglMakeCurrent( ..., !=0, !=0, EGL_NO_CONTEXT);
return setError(EGL_BAD_MATCH, (EGLBoolean)EGL_FALSE);
}
- if (cur_c == NULL) {
+ if (cur_c == nullptr) {
// no current context
// not an error, there is just no current context.
return EGL_TRUE;
@@ -1163,7 +1163,7 @@
static __eglMustCastToProperFunctionPointerType findBuiltinWrapper(
const char* procname) {
const egl_connection_t* cnx = &gEGLImpl;
- void* proc = NULL;
+ void* proc = nullptr;
proc = dlsym(cnx->libEgl, procname);
if (proc) return (__eglMustCastToProperFunctionPointerType)proc;
@@ -1174,7 +1174,7 @@
proc = dlsym(cnx->libGles1, procname);
if (proc) return (__eglMustCastToProperFunctionPointerType)proc;
- return NULL;
+ return nullptr;
}
__eglMustCastToProperFunctionPointerType eglGetProcAddress(const char *procname)
@@ -1187,11 +1187,11 @@
if (egl_init_drivers() == EGL_FALSE) {
setError(EGL_BAD_PARAMETER, NULL);
- return NULL;
+ return nullptr;
}
if (FILTER_EXTENSIONS(procname)) {
- return NULL;
+ return nullptr;
}
__eglMustCastToProperFunctionPointerType addr;
@@ -1346,7 +1346,7 @@
egl_surface_t* const s = get_surface(draw);
if (CC_UNLIKELY(dp->traceGpuCompletion)) {
- EGLSyncKHR sync = eglCreateSyncKHR(dpy, EGL_SYNC_FENCE_KHR, NULL);
+ EGLSyncKHR sync = eglCreateSyncKHR(dpy, EGL_SYNC_FENCE_KHR, nullptr);
if (sync != EGL_NO_SYNC_KHR) {
FrameCompletionThread::queueSync(sync);
}
@@ -1397,7 +1397,7 @@
EGLBoolean eglSwapBuffers(EGLDisplay dpy, EGLSurface surface)
{
- return eglSwapBuffersWithDamageKHR(dpy, surface, NULL, 0);
+ return eglSwapBuffersWithDamageKHR(dpy, surface, nullptr, 0);
}
EGLBoolean eglCopyBuffers( EGLDisplay dpy, EGLSurface surface,
@@ -1428,10 +1428,10 @@
// If we want to support EGL_EXT_client_extensions later, we can return
// the client extension string here instead.
if (dpy == EGL_NO_DISPLAY && name == EGL_EXTENSIONS)
- return setErrorQuiet(EGL_BAD_DISPLAY, (const char*)0);
+ return setErrorQuiet(EGL_BAD_DISPLAY, (const char*)nullptr);
const egl_display_ptr dp = validate_display(dpy);
- if (!dp) return (const char *) NULL;
+ if (!dp) return (const char *) nullptr;
switch (name) {
case EGL_VENDOR:
@@ -1445,7 +1445,7 @@
default:
break;
}
- return setError(EGL_BAD_PARAMETER, (const char *)0);
+ return setError(EGL_BAD_PARAMETER, (const char *)nullptr);
}
extern "C" EGLAPI const char* eglQueryStringImplementationANDROID(EGLDisplay dpy, EGLint name)
@@ -1453,7 +1453,7 @@
clearError();
const egl_display_ptr dp = validate_display(dpy);
- if (!dp) return (const char *) NULL;
+ if (!dp) return (const char *) nullptr;
switch (name) {
case EGL_VENDOR:
@@ -1467,7 +1467,7 @@
default:
break;
}
- return setError(EGL_BAD_PARAMETER, (const char *)0);
+ return setError(EGL_BAD_PARAMETER, (const char *)nullptr);
}
// ----------------------------------------------------------------------------
@@ -1649,7 +1649,7 @@
{
clearError();
- egl_connection_t* cnx = NULL;
+ egl_connection_t* cnx = nullptr;
const egl_display_ptr dp = validate_display_connection(dpy, cnx);
if (!dp) return EGL_FALSE;
if (cnx->egl.eglCreatePbufferFromClientBuffer) {
@@ -1953,7 +1953,7 @@
EGLSurface surface = cnx->egl.eglCreateStreamProducerSurfaceKHR(
dp->disp.dpy, config, stream, attrib_list);
if (surface != EGL_NO_SURFACE) {
- egl_surface_t* s = new egl_surface_t(dp.get(), config, NULL, surface,
+ egl_surface_t* s = new egl_surface_t(dp.get(), config, nullptr, surface,
EGL_GL_COLORSPACE_LINEAR_KHR, cnx);
return s;
}
@@ -2109,10 +2109,10 @@
// this function cannot be implemented when this libEGL is built for
// vendors.
#ifndef __ANDROID_VNDK__
- if (!buffer) return setError(EGL_BAD_PARAMETER, (EGLClientBuffer)0);
+ if (!buffer) return setError(EGL_BAD_PARAMETER, (EGLClientBuffer) nullptr);
return const_cast<ANativeWindowBuffer *>(AHardwareBuffer_to_ANativeWindowBuffer(buffer));
#else
- return setError(EGL_BAD_PARAMETER, (EGLClientBuffer)0);
+ return setError(EGL_BAD_PARAMETER, (EGLClientBuffer) nullptr);
#endif
}
diff --git a/opengl/libs/EGL/egl_cache.cpp b/opengl/libs/EGL/egl_cache.cpp
index ec548f3..bcf4961 100644
--- a/opengl/libs/EGL/egl_cache.cpp
+++ b/opengl/libs/EGL/egl_cache.cpp
@@ -95,7 +95,7 @@
reinterpret_cast<PFNEGLSETBLOBCACHEFUNCSANDROIDPROC>(
cnx->egl.eglGetProcAddress(
"eglSetBlobCacheFuncsANDROID"));
- if (eglSetBlobCacheFuncsANDROID == NULL) {
+ if (eglSetBlobCacheFuncsANDROID == nullptr) {
ALOGE("EGL_ANDROID_blob_cache advertised, "
"but unable to get eglSetBlobCacheFuncsANDROID");
return;
@@ -119,7 +119,7 @@
if (mBlobCache) {
mBlobCache->writeToFile();
}
- mBlobCache = NULL;
+ mBlobCache = nullptr;
}
void egl_cache_t::setBlob(const void* key, EGLsizeiANDROID keySize,
diff --git a/opengl/libs/EGL/egl_display.cpp b/opengl/libs/EGL/egl_display.cpp
index 2aec249..0235171 100644
--- a/opengl/libs/EGL/egl_display.cpp
+++ b/opengl/libs/EGL/egl_display.cpp
@@ -116,7 +116,7 @@
EGLDisplay egl_display_t::getFromNativeDisplay(EGLNativeDisplayType disp) {
if (uintptr_t(disp) >= NUM_DISPLAYS)
- return NULL;
+ return nullptr;
return sDisplay[uintptr_t(disp)].getDisplay(disp);
}
@@ -135,7 +135,7 @@
disp.dpy = dpy;
if (dpy == EGL_NO_DISPLAY) {
loader.close(cnx->dso);
- cnx->dso = NULL;
+ cnx->dso = nullptr;
}
}
@@ -148,9 +148,9 @@
std::unique_lock<std::mutex> _l(refLock);
refs++;
if (refs > 1) {
- if (major != NULL)
+ if (major != nullptr)
*major = VERSION_MAJOR;
- if (minor != NULL)
+ if (minor != nullptr)
*minor = VERSION_MINOR;
while(!eglIsInitialized) {
refCond.wait(_l);
@@ -268,9 +268,9 @@
traceGpuCompletion = true;
}
- if (major != NULL)
+ if (major != nullptr)
*major = VERSION_MAJOR;
- if (minor != NULL)
+ if (minor != nullptr)
*minor = VERSION_MINOR;
}
@@ -361,8 +361,8 @@
// by construction, these are either 0 or valid (possibly terminated)
// it should be impossible for these to be invalid
ContextRef _cur_c(cur_c);
- SurfaceRef _cur_r(cur_c ? get_surface(cur_c->read) : NULL);
- SurfaceRef _cur_d(cur_c ? get_surface(cur_c->draw) : NULL);
+ SurfaceRef _cur_r(cur_c ? get_surface(cur_c->read) : nullptr);
+ SurfaceRef _cur_d(cur_c ? get_surface(cur_c->draw) : nullptr);
{ // scope for the lock
std::lock_guard<std::mutex> _l(lock);
@@ -387,8 +387,8 @@
// by construction, these are either 0 or valid (possibly terminated)
// it should be impossible for these to be invalid
ContextRef _cur_c(cur_c);
- SurfaceRef _cur_r(cur_c ? get_surface(cur_c->read) : NULL);
- SurfaceRef _cur_d(cur_c ? get_surface(cur_c->draw) : NULL);
+ SurfaceRef _cur_r(cur_c ? get_surface(cur_c->read) : nullptr);
+ SurfaceRef _cur_d(cur_c ? get_surface(cur_c->draw) : nullptr);
{ // scope for the lock
std::lock_guard<std::mutex> _l(lock);
diff --git a/opengl/libs/EGL/egl_display.h b/opengl/libs/EGL/egl_display.h
index 79a9f08..f764028 100644
--- a/opengl/libs/EGL/egl_display.h
+++ b/opengl/libs/EGL/egl_display.h
@@ -160,7 +160,7 @@
const egl_display_t* get() const { return mDpy; }
egl_display_t* get() { return mDpy; }
- operator bool() const { return mDpy != NULL; }
+ operator bool() const { return mDpy != nullptr; }
private:
egl_display_t* mDpy;
diff --git a/opengl/libs/EGL/egl_object.cpp b/opengl/libs/EGL/egl_object.cpp
index f879254..ff4fe2d 100644
--- a/opengl/libs/EGL/egl_object.cpp
+++ b/opengl/libs/EGL/egl_object.cpp
@@ -81,14 +81,14 @@
}
egl_surface_t::~egl_surface_t() {
- if (win != NULL) {
+ if (win != nullptr) {
disconnect();
win->decStrong(this);
}
}
void egl_surface_t::disconnect() {
- if (win != NULL && connected) {
+ if (win != nullptr && connected) {
native_window_set_buffers_format(win, 0);
if (native_window_api_disconnect(win, NATIVE_WINDOW_API_EGL)) {
ALOGW("EGLNativeWindowType %p disconnect failed", win);
@@ -281,12 +281,12 @@
egl_context_t::egl_context_t(EGLDisplay dpy, EGLContext context, EGLConfig config,
egl_connection_t const* cnx, int version) :
egl_object_t(get_display_nowake(dpy)), dpy(dpy), context(context),
- config(config), read(0), draw(0), cnx(cnx), version(version) {
+ config(config), read(nullptr), draw(nullptr), cnx(cnx), version(version) {
}
void egl_context_t::onLooseCurrent() {
- read = NULL;
- draw = NULL;
+ read = nullptr;
+ draw = nullptr;
}
void egl_context_t::onMakeCurrent(EGLSurface draw, EGLSurface read) {
diff --git a/opengl/libs/EGL/egl_object.h b/opengl/libs/EGL/egl_object.h
index 4e1de5c..fb2bdf4 100644
--- a/opengl/libs/EGL/egl_object.h
+++ b/opengl/libs/EGL/egl_object.h
@@ -67,7 +67,7 @@
public:
~LocalRef();
explicit LocalRef(egl_object_t* rhs);
- explicit LocalRef(egl_display_t const* display, T o) : ref(0) {
+ explicit LocalRef(egl_display_t const* display, T o) : ref(nullptr) {
egl_object_t* native = reinterpret_cast<N*>(o);
if (o && egl_object_t::get(display, native)) {
ref = native;
diff --git a/opengl/libs/EGL/egl_tls.cpp b/opengl/libs/EGL/egl_tls.cpp
index 297a8a3..b57c357 100644
--- a/opengl/libs/EGL/egl_tls.cpp
+++ b/opengl/libs/EGL/egl_tls.cpp
@@ -28,7 +28,7 @@
pthread_once_t egl_tls_t::sOnceKey = PTHREAD_ONCE_INIT;
egl_tls_t::egl_tls_t()
- : error(EGL_SUCCESS), ctx(0), logCallWithNoContext(true) {
+ : error(EGL_SUCCESS), ctx(nullptr), logCallWithNoContext(true) {
}
const char *egl_tls_t::egl_strerror(EGLint err) {
@@ -117,7 +117,7 @@
egl_tls_t* egl_tls_t::getTLS() {
egl_tls_t* tls = (egl_tls_t*)pthread_getspecific(sKey);
- if (tls == 0) {
+ if (tls == nullptr) {
tls = new egl_tls_t;
pthread_setspecific(sKey, tls);
}
@@ -128,7 +128,7 @@
if (sKey != TLS_KEY_NOT_INITIALIZED) {
egl_tls_t* tls = (egl_tls_t*)pthread_getspecific(sKey);
if (tls) {
- pthread_setspecific(sKey, 0);
+ pthread_setspecific(sKey, nullptr);
delete tls;
}
}
diff --git a/opengl/libs/EGL/egldefs.h b/opengl/libs/EGL/egldefs.h
index 9858276..299d8f7 100644
--- a/opengl/libs/EGL/egldefs.h
+++ b/opengl/libs/EGL/egldefs.h
@@ -37,7 +37,7 @@
GLESv2_INDEX = 1
};
- inline egl_connection_t() : dso(0) { }
+ inline egl_connection_t() : dso(nullptr) { }
void * dso;
gl_hooks_t * hooks[2];
EGLint major;
diff --git a/opengl/tests/lib/WindowSurface.cpp b/opengl/tests/lib/WindowSurface.cpp
index 2b76279..b06422a 100644
--- a/opengl/tests/lib/WindowSurface.cpp
+++ b/opengl/tests/lib/WindowSurface.cpp
@@ -57,7 +57,7 @@
sp<SurfaceControl> sc = surfaceComposerClient->createSurface(
String8("Benchmark"), width, height,
PIXEL_FORMAT_RGBX_8888, ISurfaceComposerClient::eOpaque);
- if (sc == NULL || !sc->isValid()) {
+ if (sc == nullptr || !sc->isValid()) {
fprintf(stderr, "Failed to create SurfaceControl\n");
return;
}
diff --git a/opengl/tests/lib/glTestLib.cpp b/opengl/tests/lib/glTestLib.cpp
index 213dffd..290d7a0 100644
--- a/opengl/tests/lib/glTestLib.cpp
+++ b/opengl/tests/lib/glTestLib.cpp
@@ -37,7 +37,7 @@
{
const char *v = (const char *) glGetString(s);
- if (v == NULL) {
+ if (v == nullptr) {
testPrintI("GL %s unknown", name);
} else {
testPrintI("GL %s = %s", name, v);
diff --git a/opengl/tests/lib/include/EGLUtils.h b/opengl/tests/lib/include/EGLUtils.h
index 9dc6bcf..eb9571d 100644
--- a/opengl/tests/lib/include/EGLUtils.h
+++ b/opengl/tests/lib/include/EGLUtils.h
@@ -100,11 +100,11 @@
if (!attrs)
return BAD_VALUE;
- if (outConfig == NULL)
+ if (outConfig == nullptr)
return BAD_VALUE;
// Get all the "potential match" configs...
- if (eglGetConfigs(dpy, NULL, 0, &numConfigs) == EGL_FALSE)
+ if (eglGetConfigs(dpy, nullptr, 0, &numConfigs) == EGL_FALSE)
return BAD_VALUE;
std::vector<EGLConfig> configs(numConfigs);
@@ -113,7 +113,7 @@
}
int i;
- EGLConfig config = NULL;
+ EGLConfig config = nullptr;
for (i=0 ; i<n ; i++) {
EGLint nativeVisualId = 0;
eglGetConfigAttrib(dpy, configs[i], EGL_NATIVE_VISUAL_ID, &nativeVisualId);
@@ -243,7 +243,7 @@
bool EGLUtils::printEGLConfigurations(EGLDisplay dpy, String8& msg) {
EGLint numConfig = 0;
- EGLint returnVal = eglGetConfigs(dpy, NULL, 0, &numConfig);
+ EGLint returnVal = eglGetConfigs(dpy, nullptr, 0, &numConfig);
msg.append(checkEglError("eglGetConfigs", returnVal));
if (!returnVal) {
return false;