[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/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