8204967: Resolve disabled warnings for libunpack
authorsdama
Thu, 28 Jun 2018 19:44:58 +0530
changeset 50884 11b3e9c1aa5e
parent 50883 5d7442ac179a
child 50885 7c728fa9d1af
8204967: Resolve disabled warnings for libunpack Summary: Fixed warnings for libunpack Reviewed-by: jlaskey
make/launcher/Launcher-jdk.pack.gmk
src/jdk.pack/share/native/common-unpack/unpack.cpp
src/jdk.pack/share/native/common-unpack/zip.cpp
--- a/make/launcher/Launcher-jdk.pack.gmk	Thu Jun 28 15:18:17 2018 +0200
+++ b/make/launcher/Launcher-jdk.pack.gmk	Thu Jun 28 19:44:58 2018 +0530
@@ -90,7 +90,6 @@
     CFLAGS_linux := -fPIC, \
     CFLAGS_solaris := -KPIC, \
     CFLAGS_macosx := -fPIC, \
-    DISABLED_WARNINGS_gcc := unused-result implicit-fallthrough, \
     LDFLAGS := $(UNPACKEXE_ZIPOBJS) \
         $(LDFLAGS_JDKEXE) $(LDFLAGS_CXX_JDK) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
--- a/src/jdk.pack/share/native/common-unpack/unpack.cpp	Thu Jun 28 15:18:17 2018 +0200
+++ b/src/jdk.pack/share/native/common-unpack/unpack.cpp	Thu Jun 28 19:44:58 2018 +0530
@@ -1799,6 +1799,7 @@
     case 'B': case 'H': case 'I': case 'V': // unsigned_int
     case 'S': // signed_int
       --lp; // reparse
+      /* fall through */
     case 'F':
       lp = parseIntLayout(lp, b, EK_INT);
       break;
@@ -3709,7 +3710,7 @@
   case CONSTANT_Signature:
     if (value.b.ptr == null)
       return ref(0)->string();
-    // else fall through:
+    /* fall through */
   case CONSTANT_Utf8:
     buf = value.b;
     break;
@@ -4216,6 +4217,7 @@
         case _invokeinit_self_option:   classRef = thisClass;  break;
         case _invokeinit_super_option:  classRef = superClass; break;
         default: assert(bc == _invokeinit_op+_invokeinit_new_option);
+        /* fall through */
         case _invokeinit_new_option:    classRef = newClass;   break;
         }
         wp[-1] = origBC;  // overwrite with origBC
--- a/src/jdk.pack/share/native/common-unpack/zip.cpp	Thu Jun 28 15:18:17 2018 +0200
+++ b/src/jdk.pack/share/native/common-unpack/zip.cpp	Thu Jun 28 19:44:58 2018 +0530
@@ -579,8 +579,14 @@
         fseek(u->infileptr, -TRAILER_LEN, SEEK_END);
         uint filecrc;
         uint filelen;
-        fread(&filecrc, sizeof(filecrc), 1, u->infileptr);
-        fread(&filelen, sizeof(filelen), 1, u->infileptr);
+        if (fread(&filecrc, sizeof(filecrc), 1, u->infileptr) != 1) {
+            fprintf(u->errstrm, "Error:reading CRC information on input file failed err=%d\n",errno);
+            exit(1);
+        }
+        if (fread(&filelen, sizeof(filelen), 1, u->infileptr) != 1) {
+            fprintf(u->errstrm, "Error:reading file length on input file failed err=%d\n",errno);
+            exit(1);
+        }
         filecrc = SWAP_INT(filecrc);
         filelen = SWAP_INT(filelen);
         if (u->gzin->gzcrc != filecrc ||