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 563340 51c53cfbc346151d4aa685ec891bce6837be1742
parent 563339 b3c001789e3e36dc721d8d206da8f5e831c91366
child 563341 c34669f7fcc033eb598d18371183e748a010f173
push id54258
push usercpeterson@mozilla.com
push dateSun, 16 Apr 2017 05:52:14 +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