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 563964 e4e203fbfd6be50b9299851f11c1e87ec048e3ae
parent 563963 9200d40aeb5b8314cd4493de5e4abbf9f7d46c08
child 563965 339eb057a6c8b16d270d023013244672461d32ff
push id54487
push usercpeterson@mozilla.com
push dateTue, 18 Apr 2017 06:09:29 +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;
 }
-