Bug 797316 - Fix -Werror=conversion-null errors in Windows-only code (gfx/gl part) r=bjacob
authorJacek Caban <jacek@codeweavers.com>
Thu, 04 Oct 2012 10:31:56 +0200
changeset 115527 65b1536aee04e6949052c021abe213670687f280
parent 115526 d4a5f910c4461f791581cb8d13e930f6476a2088
child 115528 aaefd3bb4dba636fd43ec9cf15fa6cb59c464ccc
push id1708
push userakeybl@mozilla.com
push dateMon, 19 Nov 2012 21:10:21 +0000
treeherdermozilla-beta@27b14fe50103 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbjacob
bugs797316
milestone18.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 797316 - Fix -Werror=conversion-null errors in Windows-only code (gfx/gl part) r=bjacob
gfx/gl/GLContextProviderWGL.cpp
--- a/gfx/gl/GLContextProviderWGL.cpp
+++ b/gfx/gl/GLContextProviderWGL.cpp
@@ -214,17 +214,17 @@ WGLLibrary::EnsureInitialized(bool aUseM
     fMakeCurrent(curDC, curCtx);
 
     if (mHasRobustness) {
         fDeleteContext(mWindowGLContext);
 
         int attribs[] = {
             LOCAL_WGL_CONTEXT_FLAGS_ARB, LOCAL_WGL_CONTEXT_ROBUST_ACCESS_BIT_ARB,
             LOCAL_WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB, LOCAL_WGL_LOSE_CONTEXT_ON_RESET_ARB,
-            NULL
+            0
         };
 
         mWindowGLContext = fCreateContextAttribs(mWindowDC, NULL, attribs);
         if (!mWindowGLContext) {
             mHasRobustness = false;
             mWindowGLContext = fCreateContext(mWindowDC);
         }
     }
@@ -498,20 +498,18 @@ GLContextWGL::ResizeOffscreen(const gfxI
         };
 
         HANDLE newbuf = sWGLLib[mLibType].fCreatePbuffer(sWGLLib[mLibType].GetWindowDC(), mPixelFormat,
                                                    aNewSize.width, aNewSize.height,
                                                    pbattrs);
         if (!newbuf)
             return false;
 
-        bool isCurrent = false;
         if (sWGLLib[mLibType].fGetCurrentContext() == mContext) {
             sWGLLib[mLibType].fMakeCurrent(NULL, NULL);
-            isCurrent = true;
         }
 
         sWGLLib[mLibType].fDestroyPbuffer(mPBuffer);
 
         mPBuffer = newbuf;
         mDC = sWGLLib[mLibType].fGetPbufferDC(mPBuffer);
 
         mOffscreenSize = aNewSize;
@@ -553,17 +551,17 @@ GLContextProviderWGL::CreateForWindow(ns
     HGLRC context;
 
     GLContextWGL *shareContext = GetGlobalContextWGL();
 
     if (sWGLLib[libToUse].HasRobustness()) {
         int attribs[] = {
             LOCAL_WGL_CONTEXT_FLAGS_ARB, LOCAL_WGL_CONTEXT_ROBUST_ACCESS_BIT_ARB,
             LOCAL_WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB, LOCAL_WGL_LOSE_CONTEXT_ON_RESET_ARB,
-            NULL
+            0
         };
 
         context = sWGLLib[libToUse].fCreateContextAttribs(dc,
                                                     shareContext ? shareContext->Context() : nullptr,
                                                     attribs);
         if (!context && shareContext) {
             context = sWGLLib[libToUse].fCreateContextAttribs(dc, nullptr, attribs);
             if (context) {
@@ -673,27 +671,27 @@ CreatePBufferOffscreenContext(const gfxI
     HDC pbdc = sWGLLib[aLibToUse].fGetPbufferDC(pbuffer);
     NS_ASSERTION(pbdc, "expected a dc");
 
     HGLRC context;
     if (sWGLLib[aLibToUse].HasRobustness()) {
         int attribs[] = {
             LOCAL_WGL_CONTEXT_FLAGS_ARB, LOCAL_WGL_CONTEXT_ROBUST_ACCESS_BIT_ARB,
             LOCAL_WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB, LOCAL_WGL_LOSE_CONTEXT_ON_RESET_ARB,
-            NULL
+            0
         };
 
         context = sWGLLib[aLibToUse].fCreateContextAttribs(pbdc, nullptr, attribs);
     } else {
         context = sWGLLib[aLibToUse].fCreateContext(pbdc);
     }
 
     if (!context) {
         sWGLLib[aLibToUse].fDestroyPbuffer(pbuffer);
-        return false;
+        return nullptr;
     }
 
     nsRefPtr<GLContextWGL> glContext = new GLContextWGL(aFormat,
                                                         nullptr,
                                                         pbuffer,
                                                         pbdc,
                                                         context,
                                                         chosenFormat,
@@ -719,17 +717,17 @@ CreateWindowOffscreenContext(const Conte
         return nullptr;
     }
     
     HGLRC context = sWGLLib[libToUse].fCreateContext(dc);
     if (sWGLLib[libToUse].HasRobustness()) {
         int attribs[] = {
             LOCAL_WGL_CONTEXT_FLAGS_ARB, LOCAL_WGL_CONTEXT_ROBUST_ACCESS_BIT_ARB,
             LOCAL_WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB, LOCAL_WGL_LOSE_CONTEXT_ON_RESET_ARB,
-            NULL
+            0
         };
 
         context = sWGLLib[libToUse].fCreateContextAttribs(dc, shareContext->Context(), attribs);
     } else {
         context = sWGLLib[libToUse].fCreateContext(dc);
         if (context && shareContext &&
             !sWGLLib[libToUse].fShareLists(shareContext->Context(), context))
         {
@@ -816,17 +814,17 @@ GLContextProviderWGL::GetGlobalContext(c
         gGlobalContext[libToUse] = new GLContextWGL(ContextFormat(ContextFormat::BasicRGB24), 
                                           nullptr,
                                           sWGLLib[libToUse].GetWindowDC(), 
                                           sWGLLib[libToUse].GetWindowGLContext(),
                                           libToUse);
         if (!gGlobalContext[libToUse]->Init()) {
             NS_WARNING("Global context GLContext initialization failed?");
             gGlobalContext[libToUse] = nullptr;
-            return false;
+            return nullptr;
         }
 
         gGlobalContext[libToUse]->SetIsGlobalSharedContext(true);
     }
 
     return static_cast<GLContext*>(gGlobalContext[libToUse]);
 }