Bug 797316 - Fix -Werror=conversion-null errors in Windows-only code (widget/windows part) r=jmathies
authorJacek Caban <jacek@codeweavers.com>
Thu, 04 Oct 2012 10:33:24 +0200
changeset 115529 bd36f348362baf804d4382210b2fa4aa314dcd84
parent 115528 aaefd3bb4dba636fd43ec9cf15fa6cb59c464ccc
child 115530 1415aa5411b1355700b80f3728ee1503abf455eb
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)
reviewersjmathies
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 (widget/windows part) r=jmathies
widget/windows/WinMouseScrollHandler.cpp
widget/windows/WinUtils.cpp
widget/windows/WinUtils.h
widget/windows/nsWindow.cpp
widget/windows/nsWindow.h
widget/windows/nsWindowDbg.cpp
--- a/widget/windows/WinMouseScrollHandler.cpp
+++ b/widget/windows/WinMouseScrollHandler.cpp
@@ -256,17 +256,17 @@ MouseScrollHandler::SynthesizeNativeMous
       }
       wParam = MAKEWPARAM(mod, aDelta);
       break;
     }
     case WM_VSCROLL:
     case WM_HSCROLL:
       lParam = (aAdditionalFlags &
                   nsIDOMWindowUtils::MOUSESCROLL_WIN_SCROLL_LPARAM_NOT_NULL) ?
-        reinterpret_cast<LPARAM>(target) : NULL;
+        reinterpret_cast<LPARAM>(target) : 0;
       wParam = aDelta;
       break;
     default:
       return NS_ERROR_INVALID_ARG;
   }
 
   // Ensure to make the instance.
   GetInstance();
@@ -1366,17 +1366,17 @@ MouseScrollHandler::Device::UltraNav::Is
   PRUnichar* p = wcschr(buf, L'.');
   if (p) {
     minorVersion = wcstol(p + 1, NULL, 10);
   }
   PR_LOG(gMouseScrollLog, PR_LOG_ALWAYS,
     ("MouseScroll::Device::UltraNav::IsObsoleteDriverInstalled(): "
      "found driver version = %d.%d",
      majorVersion, minorVersion));
-  return majorVersion < 15 || majorVersion == 15 && minorVersion == 0;
+  return majorVersion < 15 || (majorVersion == 15 && minorVersion == 0);
 }
 
 /******************************************************************************
  *
  * Device::SetPoint
  *
  ******************************************************************************/
 
--- a/widget/windows/WinUtils.cpp
+++ b/widget/windows/WinUtils.cpp
@@ -68,20 +68,20 @@ WinUtils::GetRegistryKey(HKEY aRoot,
                          const PRUnichar* aValueName,
                          PRUnichar* aBuffer,
                          DWORD aBufferLength)
 {
   NS_PRECONDITION(aKeyName, "The key name is NULL");
 
   HKEY key;
   LONG result =
-    ::RegOpenKeyExW(aRoot, aKeyName, NULL, KEY_READ | KEY_WOW64_32KEY, &key);
+    ::RegOpenKeyExW(aRoot, aKeyName, 0, KEY_READ | KEY_WOW64_32KEY, &key);
   if (result != ERROR_SUCCESS) {
     result =
-      ::RegOpenKeyExW(aRoot, aKeyName, NULL, KEY_READ | KEY_WOW64_64KEY, &key);
+      ::RegOpenKeyExW(aRoot, aKeyName, 0, KEY_READ | KEY_WOW64_64KEY, &key);
     if (result != ERROR_SUCCESS) {
       return false;
     }
   }
 
   DWORD type;
   result =
     ::RegQueryValueExW(key, aValueName, NULL, &type, (BYTE*) aBuffer,
@@ -491,21 +491,21 @@ AsyncFaviconDataReady::OnComplete(nsIURI
 }
 
 // Warning: AsyncWriteIconToDisk assumes ownership of the aData buffer passed in
 AsyncWriteIconToDisk::AsyncWriteIconToDisk(const nsAString &aIconPath,
                                            const nsACString &aMimeTypeOfInputData,
                                            uint8_t *aBuffer, 
                                            uint32_t aBufferLength,
                                            const bool aURLShortcut): 
+  mURLShortcut(aURLShortcut),
   mIconPath(aIconPath),
   mMimeTypeOfInputData(aMimeTypeOfInputData),
   mBuffer(aBuffer),
-  mBufferLength(aBufferLength),
-  mURLShortcut(aURLShortcut)
+  mBufferLength(aBufferLength)
 
 {
 }
 
 NS_IMETHODIMP AsyncWriteIconToDisk::Run()
 {
   NS_PRECONDITION(!NS_IsMainThread(), "Should not be called on the main thread.");
 
@@ -687,17 +687,16 @@ NS_IMETHODIMP AsyncDeleteAllFaviconsFrom
     if (NS_FAILED(entries->GetNext(getter_AddRefs(supp))))
       break;
 
     nsCOMPtr<nsIFile> currFile(do_QueryInterface(supp));
     nsAutoString path;
     if (NS_FAILED(currFile->GetPath(path)))
       continue;
 
-    int32_t len = path.Length();
     if (StringTail(path, 4).LowerCaseEqualsASCII(".ico")) {
       // Check if the cached ICO file exists
       bool exists;
       if (NS_FAILED(currFile->Exists(&exists)) || !exists)
         continue;
 
       // We found an ICO file that exists, so we should remove it
       currFile->Remove(false);
--- a/widget/windows/WinUtils.h
+++ b/widget/windows/WinUtils.h
@@ -12,23 +12,24 @@
 #include "nsAutoPtr.h"
 #include "nsString.h"
 
 #include "nsThreadUtils.h"
 #include "nsICryptoHash.h"
 #include "nsIFaviconService.h" 
 #include "nsIDownloader.h"
 
+#include "mozilla/Attributes.h"
 
 class nsWindow;
 
 namespace mozilla {
 namespace widget {
 
-class myDownloadObserver: public nsIDownloadObserver
+class myDownloadObserver MOZ_FINAL : public nsIDownloadObserver
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIDOWNLOADOBSERVER
 };
 
 class WinUtils {
 public:
@@ -211,17 +212,17 @@ private:
   /**
    * VistaCreateItemFromParsingNameInit() initializes the static pointer for
    * SHCreateItemFromParsingName() API which is usable only on Vista and later.
    * This returns TRUE if the API is available.  Otherwise, FALSE.
    */
   static bool VistaCreateItemFromParsingNameInit();
 };
 
-class AsyncFaviconDataReady : public nsIFaviconDataCallback
+class AsyncFaviconDataReady MOZ_FINAL : public nsIFaviconDataCallback
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIFAVICONDATACALLBACK
   
   AsyncFaviconDataReady(nsIURI *aNewURI, 
                         nsCOMPtr<nsIThread> &aIOThread, 
                         const bool aURLShortcut);
--- a/widget/windows/nsWindow.cpp
+++ b/widget/windows/nsWindow.cpp
@@ -6400,17 +6400,17 @@ LRESULT nsWindow::OnKeyDown(const MSG &a
       keyinput.type = INPUT_KEYBOARD;
       keyinput.ki.wVk = aMsg.wParam;
       keyinput.ki.wScan = WinUtils::GetScanCode(aMsg.lParam);
       keyinput.ki.dwFlags = KEYEVENTF_SCANCODE;
       if (WinUtils::IsExtendedScanCode(aMsg.lParam)) {
         keyinput.ki.dwFlags |= KEYEVENTF_EXTENDEDKEY;
       }
       keyinput.ki.time = 0;
-      keyinput.ki.dwExtraInfo = NULL;
+      keyinput.ki.dwExtraInfo = 0;
 
       sRedirectedKeyDownEventPreventedDefault = noDefault;
       sRedirectedKeyDown = aMsg;
 
       ::SendInput(1, &keyinput, sizeof(keyinput));
 
       // Return here.  We shouldn't dispatch keypress event for this WM_KEYDOWN.
       // If it's needed, it will be dispatched after next (redirected)
--- a/widget/windows/nsWindow.h
+++ b/widget/windows/nsWindow.h
@@ -28,17 +28,17 @@
 #endif
 
 #include "nsWinGesture.h"
 
 #include "WindowHook.h"
 #include "TaskbarWindowPreview.h"
 
 #ifdef ACCESSIBILITY
-#include "OLEACC.H"
+#include "oleacc.h"
 #include "mozilla/a11y/Accessible.h"
 #endif
 
 #include "nsUXThemeData.h"
 
 #include "nsIDOMMouseEvent.h"
 
 #include "nsIIdleServiceInternal.h"
--- a/widget/windows/nsWindowDbg.cpp
+++ b/widget/windows/nsWindowDbg.cpp
@@ -11,18 +11,18 @@
 
 #ifdef PR_LOGGING
 extern PRLogModuleInfo* gWindowsLog;
 #endif
 
 #if defined(POPUP_ROLLUP_DEBUG_OUTPUT) || defined(EVENT_DEBUG_OUTPUT) || 1
 
 typedef struct {
-  char * mStr;
-  long   mId;
+  const char * mStr;
+  long         mId;
 } EventMsgInfo;
 
 #if defined(POPUP_ROLLUP_DEBUG_OUTPUT)
 MSGFEventMsgInfo gMSGFEvents[] = {
   "MSGF_DIALOGBOX",      0,
   "MSGF_MESSAGEBOX",     1,
   "MSGF_MENU",           2,
   "MSGF_SCROLLBAR",      5,