Bug 1356843 - Fix -Wcomma warnings in xpcom/io/nsLocalFileUnix.cpp. r=froydnj
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. xpcom/io/nsLocalFileUnix.cpp:725:48 [-Wcomma] possible misuse of comma operator here xpcom/io/nsLocalFileUnix.cpp:1053:39 [-Wcomma] possible misuse of comma operator here MozReview-Commit-ID: aebrgc5Wqk
This commit is contained in:
@@ -722,7 +722,7 @@ nsLocalFile::CopyDirectoryTo(nsIFile* aNewParent)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool hasMore = false;
|
bool hasMore = false;
|
||||||
while (dirIterator->HasMoreElements(&hasMore), hasMore) {
|
while (NS_SUCCEEDED(dirIterator->HasMoreElements(&hasMore)) && hasMore) {
|
||||||
nsCOMPtr<nsISupports> supports;
|
nsCOMPtr<nsISupports> supports;
|
||||||
nsCOMPtr<nsIFile> entry;
|
nsCOMPtr<nsIFile> entry;
|
||||||
rv = dirIterator->GetNext(getter_AddRefs(supports));
|
rv = dirIterator->GetNext(getter_AddRefs(supports));
|
||||||
@@ -1050,7 +1050,7 @@ nsLocalFile::Remove(bool aRecursive)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool more;
|
bool more;
|
||||||
while (dir->HasMoreElements(&more), more) {
|
while (NS_SUCCEEDED(dir->HasMoreElements(&more)) && more) {
|
||||||
nsCOMPtr<nsISupports> item;
|
nsCOMPtr<nsISupports> item;
|
||||||
rv = dir->GetNext(getter_AddRefs(item));
|
rv = dir->GetNext(getter_AddRefs(item));
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user