jdk/src/java.base/share/native/libjli/parse_manifest.c
changeset 29742 b73f38796859
parent 29713 eeabfe673c97
--- a/jdk/src/java.base/share/native/libjli/parse_manifest.c	Thu Apr 02 14:25:27 2015 -0400
+++ b/jdk/src/java.base/share/native/libjli/parse_manifest.c	Thu Apr 02 11:54:33 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -133,7 +133,7 @@
 
 /** Reads count bytes from fd at position pos into given buffer. */
 static jboolean
-readAt(int fd, jlong pos, size_t count, void *buf) {
+readAt(int fd, jlong pos, unsigned int count, void *buf) {
     return (pos >= 0
             && JLI_Lseek(fd, pos, SEEK_SET) == pos
             && read(fd, buf, count) == (jlong) count);
@@ -249,7 +249,7 @@
      */
     if ((pos = JLI_Lseek(fd, -ENDHDR, SEEK_END)) < (jlong)0)
         return (-1);
-    if ((bytes = read(fd, eb, ENDHDR)) < 0)
+    if (read(fd, eb, ENDHDR) < 0)
         return (-1);
     if (ENDSIG_AT(eb)) {
         return find_positions64(fd, eb, pos, base_offset, censtart);
@@ -268,7 +268,13 @@
         return (-1);
     if ((buffer = malloc(END_MAXLEN)) == NULL)
         return (-1);
-    if ((bytes = read(fd, buffer, len)) < 0) {
+
+    /*
+     * read() on windows takes an unsigned int for count. Casting len
+     * to an unsigned int here is safe since it is guaranteed to be
+     * less than END_MAXLEN.
+     */
+    if ((bytes = read(fd, buffer, (unsigned int)len)) < 0) {
         free(buffer);
         return (-1);
     }
@@ -591,7 +597,7 @@
     info->jre_version = NULL;
     info->jre_restrict_search = 0;
     info->splashscreen_image_file_name = NULL;
-    if (rc = find_file(fd, &entry, manifest_name) != 0) {
+    if ((rc = find_file(fd, &entry, manifest_name)) != 0) {
         close(fd);
         return (-2);
     }
@@ -692,7 +698,7 @@
         return (-1);
     }
 
-    if (rc = find_file(fd, &entry, manifest_name) != 0) {
+    if ((rc = find_file(fd, &entry, manifest_name)) != 0) {
         close(fd);
         return (-2);
     }