Bug 1356843 - Fix -Wcomma warnings in toolkit/. r=mossop
clang's -Wcomma warning warns about suspicious use of the comma operator such as between two statements or 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.
toolkit/components/startup/nsAppStartup.cpp:436:58 [-Wcomma] possible misuse of comma operator here
toolkit/components/statusfilter/nsBrowserStatusFilter.cpp:165:66 [-Wcomma] possible misuse of comma operator here
toolkit/xre/CreateAppData.cpp:60:51 [-Wcomma] possible misuse of comma operator here
MozReview-Commit-ID: HuZRoOjQTGj
--- a/toolkit/components/startup/nsAppStartup.cpp
+++ b/toolkit/components/startup/nsAppStartup.cpp
@@ -428,17 +428,18 @@ nsAppStartup::Quit(uint32_t aMode)
failed. This could happen for a variety of reasons; in fact it's
very likely. Perhaps we're being called from JS and the window->Close
method hasn't had a chance to wrap itself up yet. So give up.
We'll return (with eConsiderQuit) as the remaining windows are
closed. */
mediator->GetEnumerator(nullptr, getter_AddRefs(windowEnumerator));
if (windowEnumerator) {
bool more;
- while (windowEnumerator->HasMoreElements(&more), more) {
+ while (NS_SUCCEEDED(windowEnumerator->HasMoreElements(&more)) &&
+ more) {
/* we can't quit immediately. we'll try again as the last window
finally closes. */
ferocity = eAttemptQuit;
nsCOMPtr<nsISupports> window;
windowEnumerator->GetNext(getter_AddRefs(window));
nsCOMPtr<nsPIDOMWindowOuter> domWindow = do_QueryInterface(window);
if (domWindow) {
if (!domWindow->Closed()) {
--- a/toolkit/components/statusfilter/nsBrowserStatusFilter.cpp
+++ b/toolkit/components/statusfilter/nsBrowserStatusFilter.cpp
@@ -157,18 +157,18 @@ nsBrowserStatusFilter::OnStateChange(nsI
}
// If we're here, we have either STATE_START or STATE_STOP. The
// listener only cares about these in certain conditions.
bool isLoadingDocument = false;
if ((aStateFlags & nsIWebProgressListener::STATE_IS_NETWORK ||
(aStateFlags & nsIWebProgressListener::STATE_IS_REQUEST &&
mFinishedRequests == mTotalRequests &&
- (aWebProgress->GetIsLoadingDocument(&isLoadingDocument),
- !isLoadingDocument)))) {
+ NS_SUCCEEDED(aWebProgress->GetIsLoadingDocument(&isLoadingDocument)) &&
+ !isLoadingDocument))) {
if (mTimer && (aStateFlags & nsIWebProgressListener::STATE_STOP)) {
mTimer->Cancel();
ProcessTimeout();
}
return mListener->OnStateChange(aWebProgress, aRequest, aStateFlags,
aStatus);
}
--- a/toolkit/xre/CreateAppData.cpp
+++ b/toolkit/xre/CreateAppData.cpp
@@ -52,17 +52,17 @@ XRE_ParseAppData(nsIFile* aINIFile, XREA
nsresult rv;
nsINIParser parser;
rv = parser.Init(aINIFile);
if (NS_FAILED(rv))
return rv;
ReadString(parser, "App", "Vendor", aAppData.vendor);
- ReadString(parser, "App", "Name", aAppData.name),
+ ReadString(parser, "App", "Name", aAppData.name);
ReadString(parser, "App", "RemotingName", aAppData.remotingName);
ReadString(parser, "App", "Version", aAppData.version);
ReadString(parser, "App", "BuildID", aAppData.buildID);
ReadString(parser, "App", "ID", aAppData.ID);
ReadString(parser, "App", "Copyright", aAppData.copyright);
ReadString(parser, "App", "Profile", aAppData.profile);
ReadString(parser, "Gecko", "MinVersion", aAppData.minVersion);
ReadString(parser, "Gecko", "MaxVersion", aAppData.maxVersion);