Bug 1132679 - Fix warnings on windows widget and enable FAIL_ON_WARNINGS there. r=jimm
authorXidorn Quan <quanxunzhen@gmail.com>
Sat, 14 Feb 2015 11:29:29 +1100
changeset 229106 7d7c3210ea784595b9cde888f6655747707b9ee2
parent 229105 b1055d934e7119546ab4e441375810621bf89b5c
child 229107 19bb3d54cafe6d98caa58ff1d219625f55ea6629
push id55594
push userxquan@mozilla.com
push dateSat, 14 Feb 2015 00:56:23 +0000
treeherdermozilla-inbound@7d7c3210ea78 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjimm
bugs1132679
milestone38.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 1132679 - Fix warnings on windows widget and enable FAIL_ON_WARNINGS there. r=jimm
widget/windows/WinUtils.cpp
widget/windows/moz.build
widget/windows/nsFilePicker.cpp
widget/windows/nsFilePicker.h
widget/windows/nsWindow.cpp
--- a/widget/windows/WinUtils.cpp
+++ b/widget/windows/WinUtils.cpp
@@ -750,17 +750,17 @@ WinUtils::GetTopLevelHWND(HWND aWnd,
   return topWnd;
 }
 
 static const wchar_t*
 GetNSWindowPropName()
 {
   static wchar_t sPropName[40] = L"";
   if (!*sPropName) {
-    _snwprintf(sPropName, 39, L"MozillansIWidgetPtr%p",
+    _snwprintf(sPropName, 39, L"MozillansIWidgetPtr%u",
                ::GetCurrentProcessId());
     sPropName[39] = '\0';
   }
   return sPropName;
 }
 
 /* static */
 bool
--- a/widget/windows/moz.build
+++ b/widget/windows/moz.build
@@ -80,16 +80,18 @@ if CONFIG['NS_PRINTING']:
         'nsPrintSettingsWin.cpp',
     ]
 
 if CONFIG['NS_ENABLE_TSF']:
     SOURCES += [
         'nsTextStore.cpp',
     ]
 
+FAIL_ON_WARNINGS = True
+
 MSVC_ENABLE_PGO = True
 
 include('/ipc/chromium/chromium-config.mozbuild')
 
 FINAL_LIBRARY = 'xul'
 
 LOCAL_INCLUDES += [
     '/layout/generic',
--- a/widget/windows/nsFilePicker.cpp
+++ b/widget/windows/nsFilePicker.cpp
@@ -632,33 +632,37 @@ nsFilePicker::ShowFolderPicker(const nsS
   // get the folder's file system path
   return WinUtils::GetShellItemPath(item, mUnicodeFile);
 }
 
 /*
  * File open and save picker invocation
  */
 
+/* static */ bool
+nsFilePicker::GetFileNameWrapper(OPENFILENAMEW* ofn, PickerType aType)
+{
+  MOZ_SEH_TRY {
+    if (aType == PICKER_TYPE_OPEN)
+      return ::GetOpenFileNameW(ofn);
+    else if (aType == PICKER_TYPE_SAVE)
+      return ::GetSaveFileNameW(ofn);
+  } MOZ_SEH_EXCEPT(true) {
+    NS_ERROR("nsFilePicker GetFileName win32 call generated an exception! This is bad!");
+  }
+  return false;
+}
+
 bool
 nsFilePicker::FilePickerWrapper(OPENFILENAMEW* ofn, PickerType aType)
 {
   if (!ofn)
     return false;
-
-  bool result = false;
   AutoWidgetPickerState awps(mParentWidget);
-  MOZ_SEH_TRY {
-    if (aType == PICKER_TYPE_OPEN) 
-      result = ::GetOpenFileNameW(ofn);
-    else if (aType == PICKER_TYPE_SAVE)
-      result = ::GetSaveFileNameW(ofn);
-  } MOZ_SEH_EXCEPT(true) {
-    NS_ERROR("nsFilePicker GetFileName win32 call generated an exception! This is bad!");
-  }
-  return result;
+  return GetFileNameWrapper(ofn, aType);
 }
 
 bool
 nsFilePicker::ShowXPFilePicker(const nsString& aInitialDir)
 {
   OPENFILENAMEW ofn = {0};
   ofn.lStructSize = sizeof(ofn);
   nsString filterBuffer = mFilterList;
--- a/widget/windows/nsFilePicker.h
+++ b/widget/windows/nsFilePicker.h
@@ -93,16 +93,17 @@ protected:
     PICKER_TYPE_SAVE,
   };
 
   /* method from nsBaseFilePicker */
   virtual void InitNative(nsIWidget *aParent,
                           const nsAString& aTitle);
   static void GetQualifiedPath(const wchar_t *aInPath, nsString &aOutPath);
   void GetFilterListArray(nsString& aFilterList);
+  static bool GetFileNameWrapper(OPENFILENAMEW* ofn, PickerType aType);
   bool FilePickerWrapper(OPENFILENAMEW* ofn, PickerType aType);
   bool ShowXPFolderPicker(const nsString& aInitialDir);
   bool ShowXPFilePicker(const nsString& aInitialDir);
   bool ShowFolderPicker(const nsString& aInitialDir, bool &aWasInitError);
   bool ShowFilePicker(const nsString& aInitialDir, bool &aWasInitError);
   void AppendXPFilter(const nsAString& aTitle, const nsAString& aFilter);
   void RememberLastUsedDirectory();
   bool IsPrivacyModeEnabled();
--- a/widget/windows/nsWindow.cpp
+++ b/widget/windows/nsWindow.cpp
@@ -6710,17 +6710,17 @@ nsWindow::GetIMEUpdatePreference()
 {
   return IMEHandler::GetUpdatePreference();
 }
 
 #ifdef ACCESSIBILITY
 #ifdef DEBUG
 #define NS_LOG_WMGETOBJECT(aWnd, aHwnd, aAcc)                                  \
   if (a11y::logging::IsEnabled(a11y::logging::ePlatforms)) {                   \
-    printf("Get the window:\n  {\n     HWND: %d, parent HWND: %d, wndobj: %p,\n",\
+    printf("Get the window:\n  {\n     HWND: %p, parent HWND: %p, wndobj: %p,\n",\
            aHwnd, ::GetParent(aHwnd), aWnd);                                   \
     printf("     acc: %p", aAcc);                                              \
     if (aAcc) {                                                                \
       nsAutoString name;                                                       \
       aAcc->Name(name);                                                        \
       printf(", accname: %s", NS_ConvertUTF16toUTF8(name).get());              \
     }                                                                          \
     printf("\n }\n");                                                          \