Loading opengl/libs/EGL/BlobCache.cpp +3 −3 Original line number Original line Diff line number Diff line Loading @@ -79,7 +79,7 @@ void BlobCache::set(const void* key, size_t keySize, const void* value, } } std::shared_ptr<Blob> dummyKey(new Blob(key, keySize, false)); std::shared_ptr<Blob> dummyKey(new Blob(key, keySize, false)); CacheEntry dummyEntry(dummyKey, NULL); CacheEntry dummyEntry(dummyKey, nullptr); while (true) { while (true) { auto index = std::lower_bound(mCacheEntries.begin(), mCacheEntries.end(), dummyEntry); auto index = std::lower_bound(mCacheEntries.begin(), mCacheEntries.end(), dummyEntry); Loading Loading @@ -139,7 +139,7 @@ size_t BlobCache::get(const void* key, size_t keySize, void* value, return 0; return 0; } } std::shared_ptr<Blob> dummyKey(new Blob(key, keySize, false)); 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); auto index = std::lower_bound(mCacheEntries.begin(), mCacheEntries.end(), dummyEntry); if (index == mCacheEntries.end() || dummyEntry < *index) { if (index == mCacheEntries.end() || dummyEntry < *index) { ALOGV("get: no cache entry found for key of size %zu", keySize); ALOGV("get: no cache entry found for key of size %zu", keySize); Loading Loading @@ -308,7 +308,7 @@ BlobCache::Blob::Blob(const void* data, size_t size, bool copyData) : mData(copyData ? malloc(size) : data), mData(copyData ? malloc(size) : data), mSize(size), mSize(size), mOwnsData(copyData) { mOwnsData(copyData) { if (data != NULL && copyData) { if (data != nullptr && copyData) { memcpy(const_cast<void*>(mData), data, size); memcpy(const_cast<void*>(mData), data, size); } } } } Loading opengl/libs/EGL/BlobCache_test.cpp +5 −5 Original line number Original line Diff line number Diff line Loading @@ -97,7 +97,7 @@ TEST_F(BlobCacheTest, GetOnlyWritesIfBufferIsLargeEnough) { TEST_F(BlobCacheTest, GetDoesntAccessNullBuffer) { TEST_F(BlobCacheTest, GetDoesntAccessNullBuffer) { mBC->set("abcd", 4, "efgh", 4); 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) { TEST_F(BlobCacheTest, MultipleSetsCacheLatestValue) { Loading Loading @@ -169,7 +169,7 @@ TEST_F(BlobCacheTest, DoesntCacheIfKeyValuePairIsTooBig) { } } mBC->set(key, MAX_KEY_SIZE, buf, MAX_VALUE_SIZE); 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) { TEST_F(BlobCacheTest, CacheMaxKeySizeSucceeds) { Loading Loading @@ -219,7 +219,7 @@ TEST_F(BlobCacheTest, CacheMaxKeyValuePairSizeSucceeds) { } } mBC->set(key, MAX_KEY_SIZE, buf, bufSize); 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) { TEST_F(BlobCacheTest, CacheMinKeyAndValueSizeSucceeds) { Loading @@ -237,7 +237,7 @@ TEST_F(BlobCacheTest, CacheSizeDoesntExceedTotalLimit) { int numCached = 0; int numCached = 0; for (int i = 0; i < 256; i++) { for (int i = 0; i < 256; i++) { uint8_t k = i; uint8_t k = i; if (mBC->get(&k, 1, NULL, 0) == 1) { if (mBC->get(&k, 1, nullptr, 0) == 1) { numCached++; numCached++; } } } } Loading @@ -260,7 +260,7 @@ TEST_F(BlobCacheTest, ExceedingTotalLimitHalvesCacheSize) { int numCached = 0; int numCached = 0; for (int i = 0; i < maxEntries+1; i++) { for (int i = 0; i < maxEntries+1; i++) { uint8_t k = i; uint8_t k = i; if (mBC->get(&k, 1, NULL, 0) == 1) { if (mBC->get(&k, 1, nullptr, 0) == 1) { numCached++; numCached++; } } } } Loading opengl/libs/EGL/FileBlobCache.cpp +1 −1 Original line number Original line Diff line number Diff line Loading @@ -77,7 +77,7 @@ FileBlobCache::FileBlobCache(size_t maxKeySize, size_t maxValueSize, size_t maxT return; 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)); PROT_READ, MAP_PRIVATE, fd, 0)); if (buf == MAP_FAILED) { if (buf == MAP_FAILED) { ALOGE("error mmaping cache file: %s (%d)", strerror(errno), ALOGE("error mmaping cache file: %s (%d)", strerror(errno), Loading opengl/libs/EGL/Loader.cpp +17 −17 Original line number Original line Diff line number Diff line Loading @@ -129,7 +129,7 @@ Loader::driver_t::driver_t(void* gles) { { dso[0] = gles; dso[0] = gles; for (size_t i=1 ; i<NELEM(dso) ; i++) for (size_t i=1 ; i<NELEM(dso) ; i++) dso[i] = 0; dso[i] = nullptr; } } Loader::driver_t::~driver_t() Loader::driver_t::~driver_t() Loading @@ -137,7 +137,7 @@ Loader::driver_t::~driver_t() for (size_t i=0 ; i<NELEM(dso) ; i++) { for (size_t i=0 ; i<NELEM(dso) ; i++) { if (dso[i]) { if (dso[i]) { dlclose(dso[i]); dlclose(dso[i]); dso[i] = 0; dso[i] = nullptr; } } } } } } Loading @@ -163,7 +163,7 @@ int Loader::driver_t::set(void* hnd, int32_t api) // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- Loader::Loader() Loader::Loader() : getProcAddress(NULL) : getProcAddress(nullptr) { { } } Loading Loading @@ -221,7 +221,7 @@ void* Loader::open(egl_connection_t* cnx) ATRACE_CALL(); ATRACE_CALL(); void* dso; void* dso; driver_t* hnd = 0; driver_t* hnd = nullptr; setEmulatorGlesValue(); setEmulatorGlesValue(); Loading Loading @@ -272,11 +272,11 @@ void Loader::init_api(void* dso, char const * name = *api; char const * name = *api; __eglMustCastToProperFunctionPointerType f = __eglMustCastToProperFunctionPointerType f = (__eglMustCastToProperFunctionPointerType)dlsym(dso, name); (__eglMustCastToProperFunctionPointerType)dlsym(dso, name); if (f == NULL) { if (f == nullptr) { // couldn't find the entry-point, use eglGetProcAddress() // couldn't find the entry-point, use eglGetProcAddress() f = getProcAddress(name); f = getProcAddress(name); } } if (f == NULL) { if (f == nullptr) { // Try without the OES postfix // Try without the OES postfix ssize_t index = ssize_t(strlen(name)) - 3; ssize_t index = ssize_t(strlen(name)) - 3; if ((index>0 && (index<SIZE-1)) && (!strcmp(name+index, "OES"))) { if ((index>0 && (index<SIZE-1)) && (!strcmp(name+index, "OES"))) { Loading @@ -286,7 +286,7 @@ void Loader::init_api(void* dso, //ALOGD_IF(f, "found <%s> instead", scrap); //ALOGD_IF(f, "found <%s> instead", scrap); } } } } if (f == NULL) { if (f == nullptr) { // Try with the OES postfix // Try with the OES postfix ssize_t index = ssize_t(strlen(name)) - 3; ssize_t index = ssize_t(strlen(name)) - 3; if (index>0 && strcmp(name+index, "OES")) { if (index>0 && strcmp(name+index, "OES")) { Loading @@ -295,7 +295,7 @@ void Loader::init_api(void* dso, //ALOGD_IF(f, "found <%s> instead", scrap); //ALOGD_IF(f, "found <%s> instead", scrap); } } } } if (f == NULL) { if (f == nullptr) { //ALOGD("%s", name); //ALOGD("%s", name); f = (__eglMustCastToProperFunctionPointerType)gl_unimplemented; f = (__eglMustCastToProperFunctionPointerType)gl_unimplemented; Loading Loading @@ -406,9 +406,9 @@ static void* load_system_driver(const char* kind) { } } DIR* d = opendir(search); DIR* d = opendir(search); if (d != NULL) { if (d != nullptr) { struct dirent* e; struct dirent* e; while ((e = readdir(d)) != NULL) { while ((e = readdir(d)) != nullptr) { if (e->d_type == DT_DIR) { if (e->d_type == DT_DIR) { continue; continue; } } Loading @@ -434,7 +434,7 @@ static void* load_system_driver(const char* kind) { std::string absolutePath = MatchFile::find(kind); std::string absolutePath = MatchFile::find(kind); if (absolutePath.empty()) { if (absolutePath.empty()) { // this happens often, we don't want to log an error // this happens often, we don't want to log an error return 0; return nullptr; } } const char* const driver_absolute_path = absolutePath.c_str(); const char* const driver_absolute_path = absolutePath.c_str(); Loading @@ -444,10 +444,10 @@ static void* load_system_driver(const char* kind) { // sphal namespace. // sphal namespace. void* dso = do_android_load_sphal_library(driver_absolute_path, void* dso = do_android_load_sphal_library(driver_absolute_path, RTLD_NOW | RTLD_LOCAL); RTLD_NOW | RTLD_LOCAL); if (dso == 0) { if (dso == nullptr) { const char* err = dlerror(); const char* err = dlerror(); ALOGE("load_driver(%s): %s", driver_absolute_path, err ? err : "unknown"); ALOGE("load_driver(%s): %s", driver_absolute_path, err ? err : "unknown"); return 0; return nullptr; } } ALOGD("loaded %s", driver_absolute_path); ALOGD("loaded %s", driver_absolute_path); Loading Loading @@ -495,7 +495,7 @@ void *Loader::load_driver(const char* kind, if (!dso) { if (!dso) { dso = load_system_driver(kind); dso = load_system_driver(kind); if (!dso) if (!dso) return NULL; return nullptr; } } if (mask & EGL) { if (mask & EGL) { Loading @@ -512,11 +512,11 @@ void *Loader::load_driver(const char* kind, char const * name = *api; char const * name = *api; __eglMustCastToProperFunctionPointerType f = __eglMustCastToProperFunctionPointerType f = (__eglMustCastToProperFunctionPointerType)dlsym(dso, name); (__eglMustCastToProperFunctionPointerType)dlsym(dso, name); if (f == NULL) { if (f == nullptr) { // couldn't find the entry-point, use eglGetProcAddress() // couldn't find the entry-point, use eglGetProcAddress() f = getProcAddress(name); f = getProcAddress(name); if (f == NULL) { if (f == nullptr) { f = (__eglMustCastToProperFunctionPointerType)0; f = (__eglMustCastToProperFunctionPointerType)nullptr; } } } } *curr++ = f; *curr++ = f; Loading opengl/libs/EGL/egl.cpp +18 −18 Original line number Original line Diff line number Diff line Loading @@ -89,22 +89,22 @@ static int sEarlyInitState = pthread_once(&once_control, &early_egl_init); egl_display_ptr validate_display(EGLDisplay dpy) { egl_display_ptr validate_display(EGLDisplay dpy) { egl_display_ptr dp = get_display(dpy); egl_display_ptr dp = get_display(dpy); if (!dp) if (!dp) return setError(EGL_BAD_DISPLAY, egl_display_ptr(NULL)); return setError(EGL_BAD_DISPLAY, egl_display_ptr(nullptr)); if (!dp->isReady()) if (!dp->isReady()) return setError(EGL_NOT_INITIALIZED, egl_display_ptr(NULL)); return setError(EGL_NOT_INITIALIZED, egl_display_ptr(nullptr)); return dp; return dp; } } egl_display_ptr validate_display_connection(EGLDisplay dpy, egl_display_ptr validate_display_connection(EGLDisplay dpy, egl_connection_t*& cnx) { egl_connection_t*& cnx) { cnx = NULL; cnx = nullptr; egl_display_ptr dp = validate_display(dpy); egl_display_ptr dp = validate_display(dpy); if (!dp) if (!dp) return dp; return dp; cnx = &gEGLImpl; cnx = &gEGLImpl; if (cnx->dso == 0) { if (cnx->dso == nullptr) { return setError(EGL_BAD_CONFIG, egl_display_ptr(NULL)); return setError(EGL_BAD_CONFIG, egl_display_ptr(nullptr)); } } return dp; return dp; } } Loading @@ -117,14 +117,14 @@ const GLubyte * egl_get_string_for_current_context(GLenum name) { EGLContext context = egl_tls_t::getContext(); EGLContext context = egl_tls_t::getContext(); if (context == EGL_NO_CONTEXT) if (context == EGL_NO_CONTEXT) return NULL; return nullptr; egl_context_t const * const c = get_context(context); 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 NULL; return nullptr; if (name != GL_EXTENSIONS) if (name != GL_EXTENSIONS) return NULL; return nullptr; return (const GLubyte *)c->gl_extensions.c_str(); return (const GLubyte *)c->gl_extensions.c_str(); } } Loading @@ -135,19 +135,19 @@ const GLubyte * egl_get_string_for_current_context(GLenum name, GLuint index) { EGLContext context = egl_tls_t::getContext(); EGLContext context = egl_tls_t::getContext(); if (context == EGL_NO_CONTEXT) if (context == EGL_NO_CONTEXT) return NULL; return nullptr; egl_context_t const * const c = get_context(context); 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 NULL; return nullptr; if (name != GL_EXTENSIONS) if (name != GL_EXTENSIONS) return NULL; return nullptr; // if index is out of bounds, assume it will be in the default // 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 // implementation too, so we don't have to generate a GL error here if (index >= c->tokenized_gl_extensions.size()) if (index >= c->tokenized_gl_extensions.size()) return NULL; return nullptr; return (const GLubyte *)c->tokenized_gl_extensions[index].c_str(); return (const GLubyte *)c->tokenized_gl_extensions[index].c_str(); } } Loading @@ -161,7 +161,7 @@ GLint egl_get_num_extensions_for_current_context() { return -1; return -1; egl_context_t const * const c = get_context(context); 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 -1; return (GLint)c->tokenized_gl_extensions.size(); return (GLint)c->tokenized_gl_extensions.size(); Loading @@ -184,7 +184,7 @@ static EGLBoolean egl_init_drivers_locked() { // dynamically load our EGL implementation // dynamically load our EGL implementation egl_connection_t* cnx = &gEGLImpl; egl_connection_t* cnx = &gEGLImpl; if (cnx->dso == 0) { if (cnx->dso == nullptr) { cnx->hooks[egl_connection_t::GLESv1_INDEX] = cnx->hooks[egl_connection_t::GLESv1_INDEX] = &gHooks[egl_connection_t::GLESv1_INDEX]; &gHooks[egl_connection_t::GLESv1_INDEX]; cnx->hooks[egl_connection_t::GLESv2_INDEX] = cnx->hooks[egl_connection_t::GLESv2_INDEX] = Loading Loading @@ -249,12 +249,12 @@ void setGlThreadSpecific(gl_hooks_t const *value) { char const * const gl_names[] = { char const * const gl_names[] = { #include "../entries.in" #include "../entries.in" NULL nullptr }; }; char const * const egl_names[] = { char const * const egl_names[] = { #include "egl_entries.in" #include "egl_entries.in" NULL nullptr }; }; #undef GL_ENTRY #undef GL_ENTRY Loading Loading
opengl/libs/EGL/BlobCache.cpp +3 −3 Original line number Original line Diff line number Diff line Loading @@ -79,7 +79,7 @@ void BlobCache::set(const void* key, size_t keySize, const void* value, } } std::shared_ptr<Blob> dummyKey(new Blob(key, keySize, false)); std::shared_ptr<Blob> dummyKey(new Blob(key, keySize, false)); CacheEntry dummyEntry(dummyKey, NULL); CacheEntry dummyEntry(dummyKey, nullptr); while (true) { while (true) { auto index = std::lower_bound(mCacheEntries.begin(), mCacheEntries.end(), dummyEntry); auto index = std::lower_bound(mCacheEntries.begin(), mCacheEntries.end(), dummyEntry); Loading Loading @@ -139,7 +139,7 @@ size_t BlobCache::get(const void* key, size_t keySize, void* value, return 0; return 0; } } std::shared_ptr<Blob> dummyKey(new Blob(key, keySize, false)); 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); auto index = std::lower_bound(mCacheEntries.begin(), mCacheEntries.end(), dummyEntry); if (index == mCacheEntries.end() || dummyEntry < *index) { if (index == mCacheEntries.end() || dummyEntry < *index) { ALOGV("get: no cache entry found for key of size %zu", keySize); ALOGV("get: no cache entry found for key of size %zu", keySize); Loading Loading @@ -308,7 +308,7 @@ BlobCache::Blob::Blob(const void* data, size_t size, bool copyData) : mData(copyData ? malloc(size) : data), mData(copyData ? malloc(size) : data), mSize(size), mSize(size), mOwnsData(copyData) { mOwnsData(copyData) { if (data != NULL && copyData) { if (data != nullptr && copyData) { memcpy(const_cast<void*>(mData), data, size); memcpy(const_cast<void*>(mData), data, size); } } } } Loading
opengl/libs/EGL/BlobCache_test.cpp +5 −5 Original line number Original line Diff line number Diff line Loading @@ -97,7 +97,7 @@ TEST_F(BlobCacheTest, GetOnlyWritesIfBufferIsLargeEnough) { TEST_F(BlobCacheTest, GetDoesntAccessNullBuffer) { TEST_F(BlobCacheTest, GetDoesntAccessNullBuffer) { mBC->set("abcd", 4, "efgh", 4); 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) { TEST_F(BlobCacheTest, MultipleSetsCacheLatestValue) { Loading Loading @@ -169,7 +169,7 @@ TEST_F(BlobCacheTest, DoesntCacheIfKeyValuePairIsTooBig) { } } mBC->set(key, MAX_KEY_SIZE, buf, MAX_VALUE_SIZE); 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) { TEST_F(BlobCacheTest, CacheMaxKeySizeSucceeds) { Loading Loading @@ -219,7 +219,7 @@ TEST_F(BlobCacheTest, CacheMaxKeyValuePairSizeSucceeds) { } } mBC->set(key, MAX_KEY_SIZE, buf, bufSize); 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) { TEST_F(BlobCacheTest, CacheMinKeyAndValueSizeSucceeds) { Loading @@ -237,7 +237,7 @@ TEST_F(BlobCacheTest, CacheSizeDoesntExceedTotalLimit) { int numCached = 0; int numCached = 0; for (int i = 0; i < 256; i++) { for (int i = 0; i < 256; i++) { uint8_t k = i; uint8_t k = i; if (mBC->get(&k, 1, NULL, 0) == 1) { if (mBC->get(&k, 1, nullptr, 0) == 1) { numCached++; numCached++; } } } } Loading @@ -260,7 +260,7 @@ TEST_F(BlobCacheTest, ExceedingTotalLimitHalvesCacheSize) { int numCached = 0; int numCached = 0; for (int i = 0; i < maxEntries+1; i++) { for (int i = 0; i < maxEntries+1; i++) { uint8_t k = i; uint8_t k = i; if (mBC->get(&k, 1, NULL, 0) == 1) { if (mBC->get(&k, 1, nullptr, 0) == 1) { numCached++; numCached++; } } } } Loading
opengl/libs/EGL/FileBlobCache.cpp +1 −1 Original line number Original line Diff line number Diff line Loading @@ -77,7 +77,7 @@ FileBlobCache::FileBlobCache(size_t maxKeySize, size_t maxValueSize, size_t maxT return; 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)); PROT_READ, MAP_PRIVATE, fd, 0)); if (buf == MAP_FAILED) { if (buf == MAP_FAILED) { ALOGE("error mmaping cache file: %s (%d)", strerror(errno), ALOGE("error mmaping cache file: %s (%d)", strerror(errno), Loading
opengl/libs/EGL/Loader.cpp +17 −17 Original line number Original line Diff line number Diff line Loading @@ -129,7 +129,7 @@ Loader::driver_t::driver_t(void* gles) { { dso[0] = gles; dso[0] = gles; for (size_t i=1 ; i<NELEM(dso) ; i++) for (size_t i=1 ; i<NELEM(dso) ; i++) dso[i] = 0; dso[i] = nullptr; } } Loader::driver_t::~driver_t() Loader::driver_t::~driver_t() Loading @@ -137,7 +137,7 @@ Loader::driver_t::~driver_t() for (size_t i=0 ; i<NELEM(dso) ; i++) { for (size_t i=0 ; i<NELEM(dso) ; i++) { if (dso[i]) { if (dso[i]) { dlclose(dso[i]); dlclose(dso[i]); dso[i] = 0; dso[i] = nullptr; } } } } } } Loading @@ -163,7 +163,7 @@ int Loader::driver_t::set(void* hnd, int32_t api) // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- Loader::Loader() Loader::Loader() : getProcAddress(NULL) : getProcAddress(nullptr) { { } } Loading Loading @@ -221,7 +221,7 @@ void* Loader::open(egl_connection_t* cnx) ATRACE_CALL(); ATRACE_CALL(); void* dso; void* dso; driver_t* hnd = 0; driver_t* hnd = nullptr; setEmulatorGlesValue(); setEmulatorGlesValue(); Loading Loading @@ -272,11 +272,11 @@ void Loader::init_api(void* dso, char const * name = *api; char const * name = *api; __eglMustCastToProperFunctionPointerType f = __eglMustCastToProperFunctionPointerType f = (__eglMustCastToProperFunctionPointerType)dlsym(dso, name); (__eglMustCastToProperFunctionPointerType)dlsym(dso, name); if (f == NULL) { if (f == nullptr) { // couldn't find the entry-point, use eglGetProcAddress() // couldn't find the entry-point, use eglGetProcAddress() f = getProcAddress(name); f = getProcAddress(name); } } if (f == NULL) { if (f == nullptr) { // Try without the OES postfix // Try without the OES postfix ssize_t index = ssize_t(strlen(name)) - 3; ssize_t index = ssize_t(strlen(name)) - 3; if ((index>0 && (index<SIZE-1)) && (!strcmp(name+index, "OES"))) { if ((index>0 && (index<SIZE-1)) && (!strcmp(name+index, "OES"))) { Loading @@ -286,7 +286,7 @@ void Loader::init_api(void* dso, //ALOGD_IF(f, "found <%s> instead", scrap); //ALOGD_IF(f, "found <%s> instead", scrap); } } } } if (f == NULL) { if (f == nullptr) { // Try with the OES postfix // Try with the OES postfix ssize_t index = ssize_t(strlen(name)) - 3; ssize_t index = ssize_t(strlen(name)) - 3; if (index>0 && strcmp(name+index, "OES")) { if (index>0 && strcmp(name+index, "OES")) { Loading @@ -295,7 +295,7 @@ void Loader::init_api(void* dso, //ALOGD_IF(f, "found <%s> instead", scrap); //ALOGD_IF(f, "found <%s> instead", scrap); } } } } if (f == NULL) { if (f == nullptr) { //ALOGD("%s", name); //ALOGD("%s", name); f = (__eglMustCastToProperFunctionPointerType)gl_unimplemented; f = (__eglMustCastToProperFunctionPointerType)gl_unimplemented; Loading Loading @@ -406,9 +406,9 @@ static void* load_system_driver(const char* kind) { } } DIR* d = opendir(search); DIR* d = opendir(search); if (d != NULL) { if (d != nullptr) { struct dirent* e; struct dirent* e; while ((e = readdir(d)) != NULL) { while ((e = readdir(d)) != nullptr) { if (e->d_type == DT_DIR) { if (e->d_type == DT_DIR) { continue; continue; } } Loading @@ -434,7 +434,7 @@ static void* load_system_driver(const char* kind) { std::string absolutePath = MatchFile::find(kind); std::string absolutePath = MatchFile::find(kind); if (absolutePath.empty()) { if (absolutePath.empty()) { // this happens often, we don't want to log an error // this happens often, we don't want to log an error return 0; return nullptr; } } const char* const driver_absolute_path = absolutePath.c_str(); const char* const driver_absolute_path = absolutePath.c_str(); Loading @@ -444,10 +444,10 @@ static void* load_system_driver(const char* kind) { // sphal namespace. // sphal namespace. void* dso = do_android_load_sphal_library(driver_absolute_path, void* dso = do_android_load_sphal_library(driver_absolute_path, RTLD_NOW | RTLD_LOCAL); RTLD_NOW | RTLD_LOCAL); if (dso == 0) { if (dso == nullptr) { const char* err = dlerror(); const char* err = dlerror(); ALOGE("load_driver(%s): %s", driver_absolute_path, err ? err : "unknown"); ALOGE("load_driver(%s): %s", driver_absolute_path, err ? err : "unknown"); return 0; return nullptr; } } ALOGD("loaded %s", driver_absolute_path); ALOGD("loaded %s", driver_absolute_path); Loading Loading @@ -495,7 +495,7 @@ void *Loader::load_driver(const char* kind, if (!dso) { if (!dso) { dso = load_system_driver(kind); dso = load_system_driver(kind); if (!dso) if (!dso) return NULL; return nullptr; } } if (mask & EGL) { if (mask & EGL) { Loading @@ -512,11 +512,11 @@ void *Loader::load_driver(const char* kind, char const * name = *api; char const * name = *api; __eglMustCastToProperFunctionPointerType f = __eglMustCastToProperFunctionPointerType f = (__eglMustCastToProperFunctionPointerType)dlsym(dso, name); (__eglMustCastToProperFunctionPointerType)dlsym(dso, name); if (f == NULL) { if (f == nullptr) { // couldn't find the entry-point, use eglGetProcAddress() // couldn't find the entry-point, use eglGetProcAddress() f = getProcAddress(name); f = getProcAddress(name); if (f == NULL) { if (f == nullptr) { f = (__eglMustCastToProperFunctionPointerType)0; f = (__eglMustCastToProperFunctionPointerType)nullptr; } } } } *curr++ = f; *curr++ = f; Loading
opengl/libs/EGL/egl.cpp +18 −18 Original line number Original line Diff line number Diff line Loading @@ -89,22 +89,22 @@ static int sEarlyInitState = pthread_once(&once_control, &early_egl_init); egl_display_ptr validate_display(EGLDisplay dpy) { egl_display_ptr validate_display(EGLDisplay dpy) { egl_display_ptr dp = get_display(dpy); egl_display_ptr dp = get_display(dpy); if (!dp) if (!dp) return setError(EGL_BAD_DISPLAY, egl_display_ptr(NULL)); return setError(EGL_BAD_DISPLAY, egl_display_ptr(nullptr)); if (!dp->isReady()) if (!dp->isReady()) return setError(EGL_NOT_INITIALIZED, egl_display_ptr(NULL)); return setError(EGL_NOT_INITIALIZED, egl_display_ptr(nullptr)); return dp; return dp; } } egl_display_ptr validate_display_connection(EGLDisplay dpy, egl_display_ptr validate_display_connection(EGLDisplay dpy, egl_connection_t*& cnx) { egl_connection_t*& cnx) { cnx = NULL; cnx = nullptr; egl_display_ptr dp = validate_display(dpy); egl_display_ptr dp = validate_display(dpy); if (!dp) if (!dp) return dp; return dp; cnx = &gEGLImpl; cnx = &gEGLImpl; if (cnx->dso == 0) { if (cnx->dso == nullptr) { return setError(EGL_BAD_CONFIG, egl_display_ptr(NULL)); return setError(EGL_BAD_CONFIG, egl_display_ptr(nullptr)); } } return dp; return dp; } } Loading @@ -117,14 +117,14 @@ const GLubyte * egl_get_string_for_current_context(GLenum name) { EGLContext context = egl_tls_t::getContext(); EGLContext context = egl_tls_t::getContext(); if (context == EGL_NO_CONTEXT) if (context == EGL_NO_CONTEXT) return NULL; return nullptr; egl_context_t const * const c = get_context(context); 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 NULL; return nullptr; if (name != GL_EXTENSIONS) if (name != GL_EXTENSIONS) return NULL; return nullptr; return (const GLubyte *)c->gl_extensions.c_str(); return (const GLubyte *)c->gl_extensions.c_str(); } } Loading @@ -135,19 +135,19 @@ const GLubyte * egl_get_string_for_current_context(GLenum name, GLuint index) { EGLContext context = egl_tls_t::getContext(); EGLContext context = egl_tls_t::getContext(); if (context == EGL_NO_CONTEXT) if (context == EGL_NO_CONTEXT) return NULL; return nullptr; egl_context_t const * const c = get_context(context); 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 NULL; return nullptr; if (name != GL_EXTENSIONS) if (name != GL_EXTENSIONS) return NULL; return nullptr; // if index is out of bounds, assume it will be in the default // 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 // implementation too, so we don't have to generate a GL error here if (index >= c->tokenized_gl_extensions.size()) if (index >= c->tokenized_gl_extensions.size()) return NULL; return nullptr; return (const GLubyte *)c->tokenized_gl_extensions[index].c_str(); return (const GLubyte *)c->tokenized_gl_extensions[index].c_str(); } } Loading @@ -161,7 +161,7 @@ GLint egl_get_num_extensions_for_current_context() { return -1; return -1; egl_context_t const * const c = get_context(context); 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 -1; return (GLint)c->tokenized_gl_extensions.size(); return (GLint)c->tokenized_gl_extensions.size(); Loading @@ -184,7 +184,7 @@ static EGLBoolean egl_init_drivers_locked() { // dynamically load our EGL implementation // dynamically load our EGL implementation egl_connection_t* cnx = &gEGLImpl; egl_connection_t* cnx = &gEGLImpl; if (cnx->dso == 0) { if (cnx->dso == nullptr) { cnx->hooks[egl_connection_t::GLESv1_INDEX] = cnx->hooks[egl_connection_t::GLESv1_INDEX] = &gHooks[egl_connection_t::GLESv1_INDEX]; &gHooks[egl_connection_t::GLESv1_INDEX]; cnx->hooks[egl_connection_t::GLESv2_INDEX] = cnx->hooks[egl_connection_t::GLESv2_INDEX] = Loading Loading @@ -249,12 +249,12 @@ void setGlThreadSpecific(gl_hooks_t const *value) { char const * const gl_names[] = { char const * const gl_names[] = { #include "../entries.in" #include "../entries.in" NULL nullptr }; }; char const * const egl_names[] = { char const * const egl_names[] = { #include "egl_entries.in" #include "egl_entries.in" NULL nullptr }; }; #undef GL_ENTRY #undef GL_ENTRY Loading