Bug 1356843 - Fix -Wcomma warning in xpfe/appshell/nsXULWindow.cpp. r?mstange draft
authorChris Peterson <cpeterson@mozilla.com>
Sat, 08 Apr 2017 00:59:47 -0700
changeset 563346 6285a5d92c1c0a0f8d0249945cd5c81d9c105ec7
parent 563345 cf3e1f896c8a9709cb6115f3cf17f4598d5d7864
child 563347 528afe0a605c341a79d98ed2396a058ab1536e1e
push id54258
push usercpeterson@mozilla.com
push dateSun, 16 Apr 2017 05:52:14 +0000
reviewersmstange
bugs1356843
milestone55.0a1
Bug 1356843 - Fix -Wcomma warning in xpfe/appshell/nsXULWindow.cpp. r?mstange clang's -Wcomma warning warns about suspicious use of the comma operator such as calling a function for side effects within an expression. Check NS_SUCCEEDED() to use HasMoreElement() in an expression and confirm that it actually returned a legitimate out parameter. xpfe/appshell/nsXULWindow.cpp:2154:50 [-Wcomma] possible misuse of comma operator here MozReview-Commit-ID: Dbe4NDDhqY1
xpfe/appshell/nsXULWindow.cpp
--- a/xpfe/appshell/nsXULWindow.cpp
+++ b/xpfe/appshell/nsXULWindow.cpp
@@ -2146,17 +2146,17 @@ void nsXULWindow::PlaceWindowLayersBehin
   if (aBehind) {
     nsCOMPtr<nsIBaseWindow> highBase(do_QueryInterface(aBehind));
     if (highBase)
       highBase->GetMainWidget(getter_AddRefs(previousHighWidget));
   }
 
   // get next lower window
   bool more;
-  while (windowEnumerator->HasMoreElements(&more), more) {
+  while (NS_SUCCEEDED(windowEnumerator->HasMoreElements(&more)) && more) {
     uint32_t nextZ; // z-level of nextWindow
     nsCOMPtr<nsISupports> nextWindow;
     windowEnumerator->GetNext(getter_AddRefs(nextWindow));
     nsCOMPtr<nsIXULWindow> nextXULWindow(do_QueryInterface(nextWindow));
     nextXULWindow->GetZLevel(&nextZ);
     if (nextZ < aLowLevel)
       break; // we've processed all windows through aLowLevel
     
@@ -2299,9 +2299,8 @@ nsXULWindow::GetTabCount(uint32_t* aResu
 {
   if (mXULBrowserWindow) {
     return mXULBrowserWindow->GetTabCount(aResult);
   }
 
   *aResult = 0;
   return NS_OK;
 }
-