From 59bb857c7bfce63638cf5fc92418d397202825ba Mon Sep 17 00:00:00 2001 From: Matteo De Carlo Date: Wed, 8 Jan 2014 11:43:02 +0100 Subject: [PATCH] Replace NULL with nullptr in libkwineffects Completing the task of replacing all NULL to nullptr in all the files in libkwineffects folder. (also substituting some "0" used as nullptr with nullptr) REVIEW: 114823 --- libkwineffects/kwineffects.cpp | 20 +- libkwineffects/kwineffects.h | 2 +- libkwineffects/kwinglcolorcorrection.h | 2 +- libkwineffects/kwinglcolorcorrection_p.h | 2 +- libkwineffects/kwinglobals.h | 10 +- libkwineffects/kwingltexture.cpp | 6 +- libkwineffects/kwinglutils.cpp | 24 +-- libkwineffects/kwinglutils.h | 2 +- libkwineffects/kwinglutils_funcs.cpp | 260 +++++++++++------------ libkwineffects/kwinxrenderutils.cpp | 8 +- 10 files changed, 168 insertions(+), 168 deletions(-) diff --git a/libkwineffects/kwineffects.cpp b/libkwineffects/kwineffects.cpp index 3c4864bb73..dbd7ebf053 100644 --- a/libkwineffects/kwineffects.cpp +++ b/libkwineffects/kwineffects.cpp @@ -233,7 +233,7 @@ public: WindowPaintData::WindowPaintData(EffectWindow* w) : PaintData() - , shader(NULL) + , shader(nullptr) , d(new WindowPaintDataPrivate()) { quads = w->buildQuads(); @@ -492,7 +492,7 @@ void Effect::reconfigure(ReconfigureFlags) void* Effect::proxy() { - return NULL; + return nullptr; } void Effect::windowInputMouseEvent(QEvent*) @@ -655,7 +655,7 @@ KConfigGroup EffectsHandler::effectConfig(const QString& effectname) return kwinconfig->group(QStringLiteral("Effect-") + effectname); } -EffectsHandler* effects = 0; +EffectsHandler* effects = nullptr; //**************************************** @@ -1299,7 +1299,7 @@ bool WindowQuadList::isTransformed() const PaintClipper ***************************************************************/ -QStack< QRegion >* PaintClipper::areas = NULL; +QStack< QRegion >* PaintClipper::areas = nullptr; PaintClipper::PaintClipper(const QRegion& allowed_area) : area(allowed_area) @@ -1316,7 +1316,7 @@ void PaintClipper::push(const QRegion& allowed_area) { if (allowed_area == infiniteRegion()) // don't push these return; - if (areas == NULL) + if (areas == nullptr) areas = new QStack< QRegion >; areas->push(allowed_area); } @@ -1325,23 +1325,23 @@ void PaintClipper::pop(const QRegion& allowed_area) { if (allowed_area == infiniteRegion()) return; - Q_ASSERT(areas != NULL); + Q_ASSERT(areas != nullptr); Q_ASSERT(areas->top() == allowed_area); areas->pop(); if (areas->isEmpty()) { delete areas; - areas = NULL; + areas = nullptr; } } bool PaintClipper::clip() { - return areas != NULL; + return areas != nullptr; } QRegion PaintClipper::paintArea() { - assert(areas != NULL); // can be called only with clip() == true + assert(areas != nullptr); // can be called only with clip() == true QRegion ret = QRegion(0, 0, displayWidth(), displayHeight()); foreach (const QRegion & r, *areas) ret &= r; @@ -1670,7 +1670,7 @@ EffectWindow* WindowMotionManager::windowAtPoint(QPoint point, bool useStackingO ++it; } - return NULL; + return nullptr; } /*************************************************************** diff --git a/libkwineffects/kwineffects.h b/libkwineffects/kwineffects.h index 4cfd955838..1d739368b6 100644 --- a/libkwineffects/kwineffects.h +++ b/libkwineffects/kwineffects.h @@ -1527,7 +1527,7 @@ public: PAINT_DISABLED_BY_ACTIVITY = 1 << 5 }; - explicit EffectWindow(QObject *parent = NULL); + explicit EffectWindow(QObject *parent = nullptr); virtual ~EffectWindow(); virtual void enablePainting(int reason) = 0; diff --git a/libkwineffects/kwinglcolorcorrection.h b/libkwineffects/kwinglcolorcorrection.h index 90c97a9206..31ea670f1b 100644 --- a/libkwineffects/kwinglcolorcorrection.h +++ b/libkwineffects/kwinglcolorcorrection.h @@ -46,7 +46,7 @@ class KWINGLUTILS_EXPORT ColorCorrection : public QObject Q_OBJECT public: - explicit ColorCorrection(QObject *parent = 0); + explicit ColorCorrection(QObject *parent = nullptr); virtual ~ColorCorrection(); /** diff --git a/libkwineffects/kwinglcolorcorrection_p.h b/libkwineffects/kwinglcolorcorrection_p.h index 0c39b5a7fa..4bc6a84587 100644 --- a/libkwineffects/kwinglcolorcorrection_p.h +++ b/libkwineffects/kwinglcolorcorrection_p.h @@ -124,7 +124,7 @@ public: ColorServerInterface(const QString &service, const QString &path, const QDBusConnection &connection, - QObject *parent = 0); + QObject *parent = nullptr); virtual ~ColorServerInterface(); uint versionInfo() const; diff --git a/libkwineffects/kwinglobals.h b/libkwineffects/kwinglobals.h index ab7196c388..e5d98e7704 100644 --- a/libkwineffects/kwinglobals.h +++ b/libkwineffects/kwinglobals.h @@ -126,7 +126,7 @@ KWIN_EXPORT Display* display() inline KWIN_EXPORT xcb_connection_t *connection() { - static xcb_connection_t *s_con = NULL; + static xcb_connection_t *s_con = nullptr; if (!s_con) { s_con = QX11Info::connection(); } @@ -152,7 +152,7 @@ KWIN_EXPORT xcb_timestamp_t xTime() inline KWIN_EXPORT xcb_screen_t *defaultScreen() { - static xcb_screen_t *s_screen = NULL; + static xcb_screen_t *s_screen = nullptr; if (s_screen) { return s_screen; } @@ -185,17 +185,17 @@ KWIN_EXPORT int displayHeight() #define KWIN_SINGLETON_VARIABLE(ClassName, variableName) \ public: \ - static ClassName *create(QObject *parent = 0);\ + static ClassName *create(QObject *parent = nullptr);\ static ClassName *self() { return variableName; }\ protected: \ - explicit ClassName(QObject *parent = 0); \ + explicit ClassName(QObject *parent = nullptr); \ private: \ static ClassName *variableName; #define KWIN_SINGLETON(ClassName) KWIN_SINGLETON_VARIABLE(ClassName, s_self) #define KWIN_SINGLETON_FACTORY_VARIABLE_FACTORED(ClassName, FactoredClassName, variableName) \ -ClassName *ClassName::variableName = 0; \ +ClassName *ClassName::variableName = nullptr; \ ClassName *ClassName::create(QObject *parent) \ { \ Q_ASSERT(!variableName); \ diff --git a/libkwineffects/kwingltexture.cpp b/libkwineffects/kwingltexture.cpp index dba3602c10..40a5f0692f 100644 --- a/libkwineffects/kwingltexture.cpp +++ b/libkwineffects/kwingltexture.cpp @@ -129,7 +129,7 @@ GLTexturePrivate::GLTexturePrivate() m_markedDirty = false; m_unnormalizeActive = 0; m_normalizeActive = 0; - m_vbo = 0; + m_vbo = nullptr; m_filterChanged = true; m_wrapModeChanged = false; ++s_textureObjectCounter; @@ -137,7 +137,7 @@ GLTexturePrivate::GLTexturePrivate() GLTexturePrivate::~GLTexturePrivate() { - if (m_vbo != 0) { + if (m_vbo != nullptr) { delete m_vbo; } if (m_texture != 0) { @@ -165,7 +165,7 @@ void GLTexturePrivate::initStatic() sFramebufferObjectSupported = hasGLExtension(QStringLiteral("GL_EXT_framebuffer_object")); sSaturationSupported = ((hasGLExtension(QStringLiteral("GL_ARB_texture_env_crossbar")) && hasGLExtension(QStringLiteral("GL_ARB_texture_env_dot3"))) || hasGLVersion(1, 4)) - && (glTextureUnitsCount >= 4) && glActiveTexture != NULL; + && (glTextureUnitsCount >= 4) && glActiveTexture != nullptr; sTextureFormat = GL_BGRA; #endif } diff --git a/libkwineffects/kwinglutils.cpp b/libkwineffects/kwinglutils.cpp index 3c89128274..928acd47db 100644 --- a/libkwineffects/kwinglutils.cpp +++ b/libkwineffects/kwinglutils.cpp @@ -385,7 +385,7 @@ bool GLShader::compile(GLuint program, GLenum shaderType, const QByteArray &sour QByteArray preparedSource = prepareSource(shaderType, source); const char* src = preparedSource.constData(); - glShaderSource(shader, 1, &src, NULL); + glShaderSource(shader, 1, &src, nullptr); // Compile the shader glCompileShader(shader); @@ -686,7 +686,7 @@ QMatrix4x4 GLShader::getUniformMatrix4x4(const char* name) //**************************************** // ShaderManager //**************************************** -ShaderManager *ShaderManager::s_shaderManager = NULL; +ShaderManager *ShaderManager::s_shaderManager = nullptr; ShaderManager *ShaderManager::instance() { @@ -712,7 +712,7 @@ void ShaderManager::disable() void ShaderManager::cleanup() { delete s_shaderManager; - s_shaderManager = NULL; + s_shaderManager = nullptr; } ShaderManager::ShaderManager() @@ -738,7 +738,7 @@ ShaderManager::~ShaderManager() GLShader *ShaderManager::getBoundShader() const { if (m_boundShaders.isEmpty()) { - return NULL; + return nullptr; } else { return m_boundShaders.top(); } @@ -762,7 +762,7 @@ bool ShaderManager::isShaderDebug() const GLShader *ShaderManager::pushShader(ShaderType type, bool reset) { if (m_inited && !m_valid) { - return NULL; + return nullptr; } pushShader(m_shader[type]); @@ -1451,7 +1451,7 @@ void IndexBuffer::accomodate(int count) GLuint buffer; glGenBuffers(1, &buffer); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, buffer); - glBufferData(GL_ELEMENT_ARRAY_BUFFER, size, NULL, GL_STATIC_DRAW); + glBufferData(GL_ELEMENT_ARRAY_BUFFER, size, nullptr, GL_STATIC_DRAW); // Use the GPU to copy the data from the old object to the new object, glBindBuffer(GL_COPY_READ_BUFFER, m_buffer); @@ -1628,9 +1628,9 @@ public: bool GLVertexBufferPrivate::supported = false; bool GLVertexBufferPrivate::hasMapBufferRange = false; bool GLVertexBufferPrivate::supportsIndexedQuads = false; -GLVertexBuffer *GLVertexBufferPrivate::streamingBuffer = NULL; +GLVertexBuffer *GLVertexBufferPrivate::streamingBuffer = nullptr; #ifndef KWIN_HAVE_OPENGLES -IndexBuffer *GLVertexBufferPrivate::s_indexBuffer = NULL; +IndexBuffer *GLVertexBufferPrivate::s_indexBuffer = nullptr; #endif void GLVertexBufferPrivate::interleaveArrays(float *dst, int dim, @@ -1932,12 +1932,12 @@ void GLVertexBuffer::draw(const QRegion ®ion, GLenum primitiveMode, int first count = count * 6 / 4; if (!hardwareClipping) { - glDrawElementsBaseVertex(GL_TRIANGLES, count, GL_UNSIGNED_SHORT, NULL, first); + glDrawElementsBaseVertex(GL_TRIANGLES, count, GL_UNSIGNED_SHORT, nullptr, first); } else { // Clip using scissoring foreach (const QRect &r, region.rects()) { glScissor(r.x(), displayHeight() - r.y() - r.height(), r.width(), r.height()); - glDrawElementsBaseVertex(GL_TRIANGLES, count, GL_UNSIGNED_SHORT, NULL, first); + glDrawElementsBaseVertex(GL_TRIANGLES, count, GL_UNSIGNED_SHORT, nullptr, first); } } return; @@ -1998,7 +1998,7 @@ void GLVertexBuffer::initStatic() GLVertexBufferPrivate::supported = hasGLVersion(1, 5) || hasGLExtension(QStringLiteral("GL_ARB_vertex_buffer_object")); GLVertexBufferPrivate::hasMapBufferRange = hasGLVersion(3, 0) || hasGLExtension(QStringLiteral("GL_ARB_map_buffer_range")); GLVertexBufferPrivate::supportsIndexedQuads = glMapBufferRange && glCopyBufferSubData && glDrawElementsBaseVertex; - GLVertexBufferPrivate::s_indexBuffer = 0; + GLVertexBufferPrivate::s_indexBuffer = nullptr; #endif GLVertexBufferPrivate::streamingBuffer = new GLVertexBuffer(GLVertexBuffer::Stream); } @@ -2007,7 +2007,7 @@ void GLVertexBuffer::cleanup() { #ifndef KWIN_HAVE_OPENGLES delete GLVertexBufferPrivate::s_indexBuffer; - GLVertexBufferPrivate::s_indexBuffer = 0; + GLVertexBufferPrivate::s_indexBuffer = nullptr; #endif } diff --git a/libkwineffects/kwinglutils.h b/libkwineffects/kwinglutils.h index a3e91a1965..63e0d2a3b0 100644 --- a/libkwineffects/kwinglutils.h +++ b/libkwineffects/kwinglutils.h @@ -469,7 +469,7 @@ private: inline ShaderBinder::ShaderBinder(ShaderManager::ShaderType type, bool reset) - : m_shader(NULL) + : m_shader(nullptr) { #ifdef KWIN_HAVE_OPENGL_1 if (!ShaderManager::instance()->isValid()) { diff --git a/libkwineffects/kwinglutils_funcs.cpp b/libkwineffects/kwinglutils_funcs.cpp index 5576a02f9b..0552a36157 100644 --- a/libkwineffects/kwinglutils_funcs.cpp +++ b/libkwineffects/kwinglutils_funcs.cpp @@ -208,10 +208,10 @@ glCopyBufferSubData_func glCopyBufferSubData; static glXFuncPtr getProcAddress(const char* name) { - glXFuncPtr ret = NULL; - if (glXGetProcAddress != NULL) + glXFuncPtr ret = nullptr; + if (glXGetProcAddress != nullptr) ret = glXGetProcAddress((const GLubyte*) name); - if (ret == NULL) + if (ret == nullptr) ret = (glXFuncPtr) dlsym(RTLD_DEFAULT, name); return ret; } @@ -220,45 +220,45 @@ void glxResolveFunctions() { // handle OpenGL extensions functions glXGetProcAddress = (glXGetProcAddress_func) getProcAddress("glXGetProcAddress"); - if (glXGetProcAddress == NULL) + if (glXGetProcAddress == nullptr) glXGetProcAddress = (glXGetProcAddress_func) getProcAddress("glXGetProcAddressARB"); glXQueryDrawable = (glXQueryDrawable_func) getProcAddress("glXQueryDrawable"); if (hasGLExtension(QStringLiteral("GLX_EXT_texture_from_pixmap"))) { glXBindTexImageEXT = (glXBindTexImageEXT_func) getProcAddress("glXBindTexImageEXT"); glXReleaseTexImageEXT = (glXReleaseTexImageEXT_func) getProcAddress("glXReleaseTexImageEXT"); } else { - glXBindTexImageEXT = NULL; - glXReleaseTexImageEXT = NULL; + glXBindTexImageEXT = nullptr; + glXReleaseTexImageEXT = nullptr; } if (hasGLExtension(QStringLiteral("GLX_MESA_copy_sub_buffer"))) glXCopySubBuffer = (glXCopySubBuffer_func) getProcAddress("glXCopySubBufferMESA"); else - glXCopySubBuffer = NULL; + glXCopySubBuffer = nullptr; if (hasGLExtension(QStringLiteral("GLX_SGI_video_sync"))) { glXGetVideoSync = (glXGetVideoSync_func) getProcAddress("glXGetVideoSyncSGI"); glXWaitVideoSync = (glXWaitVideoSync_func) getProcAddress("glXWaitVideoSyncSGI"); } else { - glXGetVideoSync = NULL; - glXWaitVideoSync = NULL; + glXGetVideoSync = nullptr; + glXWaitVideoSync = nullptr; } if (hasGLExtension(QStringLiteral("GLX_SGI_swap_control"))) glXSwapIntervalSGI = (glXSwapIntervalSGI_func) getProcAddress("glXSwapIntervalSGI"); else - glXSwapIntervalSGI = NULL; + glXSwapIntervalSGI = nullptr; if (hasGLExtension(QStringLiteral("GLX_EXT_swap_control"))) glXSwapIntervalEXT = (glXSwapIntervalEXT_func) getProcAddress("glXSwapIntervalEXT"); else - glXSwapIntervalEXT = NULL; + glXSwapIntervalEXT = nullptr; if (hasGLExtension(QStringLiteral("GLX_MESA_swap_control"))) glXSwapIntervalMESA = (glXSwapIntervalMESA_func) getProcAddress("glXSwapIntervalMESA"); else - glXSwapIntervalMESA = NULL; + glXSwapIntervalMESA = nullptr; if (hasGLExtension(QStringLiteral("GLX_ARB_create_context"))) glXCreateContextAttribsARB = (glXCreateContextAttribsARB_func) getProcAddress("glXCreateContextAttribsARB"); else - glXCreateContextAttribsARB = NULL; + glXCreateContextAttribsARB = nullptr; } #else @@ -301,14 +301,14 @@ void eglResolveFunctions() eglCreateImageKHR = (eglCreateImageKHR_func)eglGetProcAddress("eglCreateImageKHR"); eglDestroyImageKHR = (eglDestroyImageKHR_func)eglGetProcAddress("eglDestroyImageKHR"); } else { - eglCreateImageKHR = NULL; - eglDestroyImageKHR = NULL; + eglCreateImageKHR = nullptr; + eglDestroyImageKHR = nullptr; } if (hasGLExtension(QStringLiteral("EGL_NV_post_sub_buffer"))) { eglPostSubBufferNV = (eglPostSubBufferNV_func)eglGetProcAddress("eglPostSubBufferNV"); } else { - eglPostSubBufferNV = NULL; + eglPostSubBufferNV = nullptr; } } #endif @@ -325,7 +325,7 @@ void glResolveFunctions(OpenGLPlatformInterface platformInterface) // Get number of texture units glGetIntegerv(GL_MAX_TEXTURE_UNITS, &glTextureUnitsCount); } else { - glActiveTexture = NULL; + glActiveTexture = nullptr; glTextureUnitsCount = 0; } @@ -384,23 +384,23 @@ void glResolveFunctions(OpenGLPlatformInterface platformInterface) GL_RESOLVE_WITH_EXT(glGenerateMipmap, glGenerateMipmapEXT); } else { - glIsRenderbuffer = NULL; - glBindRenderbuffer = NULL; - glDeleteRenderbuffers = NULL; - glGenRenderbuffers = NULL; - glRenderbufferStorage = NULL; - glGetRenderbufferParameteriv = NULL; - glIsFramebuffer = NULL; - glBindFramebuffer = NULL; - glDeleteFramebuffers = NULL; - glGenFramebuffers = NULL; - glCheckFramebufferStatus = NULL; - glFramebufferTexture1D = NULL; - glFramebufferTexture2D = NULL; - glFramebufferTexture3D = NULL; - glFramebufferRenderbuffer = NULL; - glGetFramebufferAttachmentParameteriv = NULL; - glGenerateMipmap = NULL; + glIsRenderbuffer = nullptr; + glBindRenderbuffer = nullptr; + glDeleteRenderbuffers = nullptr; + glGenRenderbuffers = nullptr; + glRenderbufferStorage = nullptr; + glGetRenderbufferParameteriv = nullptr; + glIsFramebuffer = nullptr; + glBindFramebuffer = nullptr; + glDeleteFramebuffers = nullptr; + glGenFramebuffers = nullptr; + glCheckFramebufferStatus = nullptr; + glFramebufferTexture1D = nullptr; + glFramebufferTexture2D = nullptr; + glFramebufferTexture3D = nullptr; + glFramebufferRenderbuffer = nullptr; + glGetFramebufferAttachmentParameteriv = nullptr; + glGenerateMipmap = nullptr; } if (hasGLVersion(3, 0) || hasGLExtension(QStringLiteral("GL_ARB_framebuffer_object"))) { @@ -410,7 +410,7 @@ void glResolveFunctions(OpenGLPlatformInterface platformInterface) // see http://www.opengl.org/registry/specs/EXT/framebuffer_blit.txt GL_RESOLVE_WITH_EXT(glBlitFramebuffer, glBlitFramebufferEXT); } else { - glBlitFramebuffer = NULL; + glBlitFramebuffer = nullptr; } if (hasGLVersion(2, 0)) { @@ -469,32 +469,32 @@ void glResolveFunctions(OpenGLPlatformInterface platformInterface) GL_RESOLVE_WITH_EXT(glGetUniformLocation, glGetUniformLocationARB); GL_RESOLVE_WITH_EXT(glGetUniformfv, glGetUniformfvARB); } else { - glCreateShader = NULL; - glShaderSource = NULL; - glCompileShader = NULL; - glDeleteShader = NULL; - glCreateProgram = NULL; - glAttachShader = NULL; - glLinkProgram = NULL; - glUseProgram = NULL; - glDeleteProgram = NULL; - glGetShaderInfoLog = NULL; - glGetProgramInfoLog = NULL; - glGetProgramiv = NULL; - glGetShaderiv = NULL; - glUniform1f = NULL; - glUniform2f = NULL; - glUniform3f = NULL; - glUniform4f = NULL; - glUniform1i = NULL; - glUniform1fv = NULL; - glUniform2fv = NULL; - glUniform3fv = NULL; - glUniform4fv = NULL; - glUniformMatrix4fv = NULL; - glValidateProgram = NULL; - glGetUniformLocation = NULL; - glGetUniformfv = NULL; + glCreateShader = nullptr; + glShaderSource = nullptr; + glCompileShader = nullptr; + glDeleteShader = nullptr; + glCreateProgram = nullptr; + glAttachShader = nullptr; + glLinkProgram = nullptr; + glUseProgram = nullptr; + glDeleteProgram = nullptr; + glGetShaderInfoLog = nullptr; + glGetProgramInfoLog = nullptr; + glGetProgramiv = nullptr; + glGetShaderiv = nullptr; + glUniform1f = nullptr; + glUniform2f = nullptr; + glUniform3f = nullptr; + glUniform4f = nullptr; + glUniform1i = nullptr; + glUniform1fv = nullptr; + glUniform2fv = nullptr; + glUniform3fv = nullptr; + glUniform4fv = nullptr; + glUniformMatrix4fv = nullptr; + glValidateProgram = nullptr; + glGetUniformLocation = nullptr; + glGetUniformfv = nullptr; } if (hasGLVersion(2, 0)) { @@ -513,12 +513,12 @@ void glResolveFunctions(OpenGLPlatformInterface platformInterface) GL_RESOLVE_WITH_EXT(glDisableVertexAttribArray, glDisableVertexAttribArrayARB); GL_RESOLVE_WITH_EXT(glVertexAttribPointer, glVertexAttribPointerARB); } else { - glVertexAttrib1f = NULL; - glBindAttribLocation = NULL; - glGetAttribLocation = NULL; - glEnableVertexAttribArray = NULL; - glDisableVertexAttribArray = NULL; - glVertexAttribPointer = NULL; + glVertexAttrib1f = nullptr; + glBindAttribLocation = nullptr; + glGetAttribLocation = nullptr; + glEnableVertexAttribArray = nullptr; + glDisableVertexAttribArray = nullptr; + glVertexAttribPointer = nullptr; } if (hasGLExtension(QStringLiteral("GL_ARB_fragment_program")) && hasGLExtension(QStringLiteral("GL_ARB_vertex_program"))) { @@ -530,12 +530,12 @@ void glResolveFunctions(OpenGLPlatformInterface platformInterface) GL_RESOLVE(glProgramLocalParameter4fARB); GL_RESOLVE(glGetProgramivARB); } else { - glProgramStringARB = NULL; - glBindProgramARB = NULL; - glDeleteProgramsARB = NULL; - glGenProgramsARB = NULL; - glProgramLocalParameter4fARB = NULL; - glGetProgramivARB = NULL; + glProgramStringARB = nullptr; + glBindProgramARB = nullptr; + glDeleteProgramsARB = nullptr; + glGenProgramsARB = nullptr; + glProgramLocalParameter4fARB = nullptr; + glGetProgramivARB = nullptr; } if (hasGLVersion(1, 5)) { @@ -557,14 +557,14 @@ void glResolveFunctions(OpenGLPlatformInterface platformInterface) GL_RESOLVE_WITH_EXT(glMapBuffer, glMapBufferARB); GL_RESOLVE_WITH_EXT(glUnmapBuffer, glUnmapBufferARB); } else { - glGenBuffers = NULL; - glDeleteBuffers = NULL; - glBindBuffer = NULL; - glBufferData = NULL; - glBufferSubData = NULL; - glGetBufferSubData = NULL; - glMapBuffer = NULL; - glUnmapBuffer = NULL; + glGenBuffers = nullptr; + glDeleteBuffers = nullptr; + glBindBuffer = nullptr; + glBufferData = nullptr; + glBufferSubData = nullptr; + glGetBufferSubData = nullptr; + glMapBuffer = nullptr; + glUnmapBuffer = nullptr; } if (hasGLVersion(3, 0) || hasGLExtension(QStringLiteral("GL_ARB_vertex_array_object"))) { @@ -574,10 +574,10 @@ void glResolveFunctions(OpenGLPlatformInterface platformInterface) GL_RESOLVE(glGenVertexArrays); GL_RESOLVE(glIsVertexArray); } else { - glBindVertexArray = NULL; - glDeleteVertexArrays = NULL; - glGenVertexArrays = NULL; - glIsVertexArray = NULL; + glBindVertexArray = nullptr; + glDeleteVertexArrays = nullptr; + glGenVertexArrays = nullptr; + glIsVertexArray = nullptr; } if (hasGLVersion(3, 0)) { @@ -650,39 +650,39 @@ void glResolveFunctions(OpenGLPlatformInterface platformInterface) GL_RESOLVE_WITH_EXT(glUniform2uiv, glUniform2uivEXT); GL_RESOLVE_WITH_EXT(glUniform3uiv, glUniform3uivEXT); } else { - glVertexAttribI1i = NULL; - glVertexAttribI2i = NULL; - glVertexAttribI3i = NULL; - glVertexAttribI4i = NULL; - glVertexAttribI1ui = NULL; - glVertexAttribI2ui = NULL; - glVertexAttribI3ui = NULL; - glVertexAttribI4ui = NULL; - glVertexAttribI1iv = NULL; - glVertexAttribI2iv = NULL; - glVertexAttribI3iv = NULL; - glVertexAttribI4iv = NULL; - glVertexAttribI1uiv = NULL; - glVertexAttribI2uiv = NULL; - glVertexAttribI3uiv = NULL; - glVertexAttribI4uiv = NULL; - glVertexAttribI4bv = NULL; - glVertexAttribI4sv = NULL; - glVertexAttribI4ubv = NULL; - glVertexAttribI4usv = NULL; - glVertexAttribIPointer = NULL; - glGetVertexAttribIiv = NULL; - glGetVertexAttribIuiv = NULL; - glGetUniformuiv = NULL; - glBindFragDataLocation = NULL; - glGetFragDataLocation = NULL; - glUniform1ui = NULL; - glUniform2ui = NULL; - glUniform3ui = NULL; - glUniform4ui = NULL; - glUniform1uiv = NULL; - glUniform2uiv = NULL; - glUniform3uiv = NULL; + glVertexAttribI1i = nullptr; + glVertexAttribI2i = nullptr; + glVertexAttribI3i = nullptr; + glVertexAttribI4i = nullptr; + glVertexAttribI1ui = nullptr; + glVertexAttribI2ui = nullptr; + glVertexAttribI3ui = nullptr; + glVertexAttribI4ui = nullptr; + glVertexAttribI1iv = nullptr; + glVertexAttribI2iv = nullptr; + glVertexAttribI3iv = nullptr; + glVertexAttribI4iv = nullptr; + glVertexAttribI1uiv = nullptr; + glVertexAttribI2uiv = nullptr; + glVertexAttribI3uiv = nullptr; + glVertexAttribI4uiv = nullptr; + glVertexAttribI4bv = nullptr; + glVertexAttribI4sv = nullptr; + glVertexAttribI4ubv = nullptr; + glVertexAttribI4usv = nullptr; + glVertexAttribIPointer = nullptr; + glGetVertexAttribIiv = nullptr; + glGetVertexAttribIuiv = nullptr; + glGetUniformuiv = nullptr; + glBindFragDataLocation = nullptr; + glGetFragDataLocation = nullptr; + glUniform1ui = nullptr; + glUniform2ui = nullptr; + glUniform3ui = nullptr; + glUniform4ui = nullptr; + glUniform1uiv = nullptr; + glUniform2uiv = nullptr; + glUniform3uiv = nullptr; } if (hasGLVersion(3, 0) || hasGLExtension(QStringLiteral("GL_ARB_map_buffer_range"))) { @@ -690,8 +690,8 @@ void glResolveFunctions(OpenGLPlatformInterface platformInterface) GL_RESOLVE(glMapBufferRange); GL_RESOLVE(glFlushMappedBufferRange); } else { - glMapBufferRange = NULL; - glFlushMappedBufferRange = NULL; + glMapBufferRange = nullptr; + glFlushMappedBufferRange = nullptr; } if (hasGLExtension(QStringLiteral("GL_ARB_robustness"))) { @@ -710,15 +710,15 @@ void glResolveFunctions(OpenGLPlatformInterface platformInterface) GL_RESOLVE(glDrawElementsBaseVertex); GL_RESOLVE(glDrawElementsInstancedBaseVertex); } else { - glDrawElementsBaseVertex = NULL; - glDrawElementsInstancedBaseVertex = NULL; + glDrawElementsBaseVertex = nullptr; + glDrawElementsInstancedBaseVertex = nullptr; } if (hasGLVersion(3, 1) || hasGLExtension(QStringLiteral("GL_ARB_copy_buffer"))) { // See http://www.opengl.org/registry/specs/ARB/copy_buffer.txt GL_RESOLVE(glCopyBufferSubData); } else { - glCopyBufferSubData = NULL; + glCopyBufferSubData = nullptr; } #else @@ -729,15 +729,15 @@ void glResolveFunctions(OpenGLPlatformInterface platformInterface) glUnmapBuffer = (glUnmapBuffer_func) eglGetProcAddress("glUnmapBufferOES"); glGetBufferPointerv = (glGetBufferPointerv_func) eglGetProcAddress("glGetBufferPointervOES"); } else { - glMapBuffer = NULL; - glUnmapBuffer = NULL; - glGetBufferPointerv = NULL; + glMapBuffer = nullptr; + glUnmapBuffer = nullptr; + glGetBufferPointerv = nullptr; } if (hasGLExtension(QStringLiteral("GL_OES_texture_3D"))) { glTexImage3D = (glTexImage3DOES_func)eglGetProcAddress("glTexImage3DOES"); } else { - glTexImage3D = NULL; + glTexImage3D = nullptr; } if (hasGLExtension(QStringLiteral("GL_EXT_map_buffer_range"))) { @@ -745,8 +745,8 @@ void glResolveFunctions(OpenGLPlatformInterface platformInterface) glMapBufferRange = (glMapBufferRange_func) eglGetProcAddress("glMapBufferRangeEXT"); glFlushMappedBufferRange = (glFlushMappedBufferRange_func) eglGetProcAddress("glFlushMappedBufferRangeEXT"); } else { - glMapBufferRange = NULL; - glFlushMappedBufferRange = NULL; + glMapBufferRange = nullptr; + glFlushMappedBufferRange = nullptr; } if (hasGLExtension(QStringLiteral("GL_EXT_robustness"))) { @@ -767,7 +767,7 @@ void glResolveFunctions(OpenGLPlatformInterface platformInterface) if (hasGLExtension(QStringLiteral("GL_OES_EGL_image"))) { glEGLImageTargetTexture2DOES = (glEGLImageTargetTexture2DOES_func)eglGetProcAddress("glEGLImageTargetTexture2DOES"); } else { - glEGLImageTargetTexture2DOES = NULL; + glEGLImageTargetTexture2DOES = nullptr; } } #endif diff --git a/libkwineffects/kwinxrenderutils.cpp b/libkwineffects/kwinxrenderutils.cpp index 9c741b1a20..9c53182903 100644 --- a/libkwineffects/kwinxrenderutils.cpp +++ b/libkwineffects/kwinxrenderutils.cpp @@ -82,7 +82,7 @@ static xcb_render_picture_t createPicture(xcb_pixmap_t pix, int depth) return XCB_RENDER_PICTURE_NONE; static QHash s_renderFormats; if (!s_renderFormats.contains(depth)) { - xcb_render_query_pict_formats_reply_t *formats = xcb_render_query_pict_formats_reply(connection(), xcb_render_query_pict_formats_unchecked(connection()), NULL); + xcb_render_query_pict_formats_reply_t *formats = xcb_render_query_pict_formats_reply(connection(), xcb_render_query_pict_formats_unchecked(connection()), nullptr); if (!formats) { return XCB_RENDER_PICTURE_NONE; } @@ -102,7 +102,7 @@ static xcb_render_picture_t createPicture(xcb_pixmap_t pix, int depth) return XCB_RENDER_PICTURE_NONE; } xcb_render_picture_t pic = xcb_generate_id(connection()); - xcb_render_create_picture(connection(), pic, pix, it.value(), 0, NULL); + xcb_render_create_picture(connection(), pic, pix, it.value(), 0, nullptr); return pic; } @@ -118,7 +118,7 @@ void XRenderPicture::fromImage(const QImage &img) xcb_create_pixmap(connection(), depth, xpix, rootWindow(), img.width(), img.height()); xcb_gcontext_t cid = xcb_generate_id(connection()); - xcb_create_gc(connection(), cid, xpix, 0, NULL); + xcb_create_gc(connection(), cid, xpix, 0, nullptr); xcb_put_image(connection(), XCB_IMAGE_FORMAT_Z_PIXMAP, xpix, cid, img.width(), img.height(), 0, 0, 0, depth, img.byteCount(), img.constBits()); xcb_free_gc(connection(), cid); @@ -143,7 +143,7 @@ void scene_setXRenderOffscreenTarget(xcb_render_picture_t pix) XRenderPicture *scene_xRenderOffscreenTarget() { - return s_scene_offscreenTargetStack.isEmpty() ? 0 : s_scene_offscreenTargetStack.top(); + return s_scene_offscreenTargetStack.isEmpty() ? nullptr : s_scene_offscreenTargetStack.top(); } void setXRenderOffscreen(bool b)