Bug 1356843 - Fix -Wcomma warning in modules/libjar/nsZipArchive.cpp. r=aklotz draft
authorChris Peterson <cpeterson@mozilla.com>
Mon, 27 Mar 2017 21:39:36 -0700
changeset 563950 d25658a39026821bf0b455967872001fb4816da5
parent 563949 226579518bb9989b0812ef217499c7bc69a84806
child 563951 2caaedd75d43b6ce4364d01d75823c43c621e82a
push id54485
push usercpeterson@mozilla.com
push dateTue, 18 Apr 2017 05:57:33 +0000
reviewersaklotz
bugs1356843
milestone55.0a1
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
modules/libjar/nsZipArchive.cpp
--- 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