Bug 1356843 - Fix -Wcomma warning in modules/libjar/nsZipArchive.cpp. r=aklotz
clang's -Wcomma warning warns about suspicious use of the comma operator such as between two statements or to call a function for side effects within an expression.
modules/libjar/nsZipArchive.cpp:651:25 [-Wcomma] possible misuse of comma operator here
MozReview-Commit-ID: 9PjB915D81f
--- a/modules/libjar/nsZipArchive.cpp
+++ b/modules/libjar/nsZipArchive.cpp
@@ -634,20 +634,23 @@ static nsresult ResolveSymlink(const cha
PRFileDesc * fIn = PR_Open(path, PR_RDONLY, 0000);
if (!fIn)
return NS_ERROR_FILE_DISK_FULL;
char buf[PATH_MAX+1];
int32_t length = PR_Read(fIn, (void*)buf, PATH_MAX);
PR_Close(fIn);
- if ( (length <= 0)
- || ((buf[length] = 0, PR_Delete(path)) != 0)
- || (symlink(buf, path) != 0))
- {
+ if (length <= 0) {
+ return NS_ERROR_FILE_DISK_FULL;
+ }
+
+ buf[length] = '\0';
+
+ if (PR_Delete(path) != 0 || symlink(buf, path) != 0) {
return NS_ERROR_FILE_DISK_FULL;
}
return NS_OK;
}
#endif
//***********************************************************
// nsZipArchive -- private implementation