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
--- 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;
}
-