6989471: compiler warnings building java/zip native code
Summary: remvoed the warning
Reviewed-by: ohair, alanb
--- a/jdk/src/share/native/java/util/zip/zip_util.c Fri Nov 19 10:00:08 2010 -0800
+++ b/jdk/src/share/native/java/util/zip/zip_util.c Fri Nov 19 12:55:42 2010 -0800
@@ -314,7 +314,7 @@
if (pos < 0) {
/* Pretend there are some NUL bytes before start of file */
off = -pos;
- memset(buf, '\0', off);
+ memset(buf, '\0', (size_t)off);
}
if (readFullyAt(zfd, buf + off, sizeof(buf) - off,
@@ -426,7 +426,7 @@
isMetaName(const char *name, int length)
{
const char *s;
- if (length < sizeof("META-INF/") - 1)
+ if (length < (int)sizeof("META-INF/") - 1)
return 0;
for (s = "META-INF/"; *s != '\0'; s++) {
char c = *name++;
@@ -912,7 +912,7 @@
ZFILE zfd = zip->zfd;
char *cen;
if (bufsize > zip->len - cenpos)
- bufsize = zip->len - cenpos;
+ bufsize = (jint)(zip->len - cenpos);
if ((cen = malloc(bufsize)) == NULL) goto Catch;
if (readFullyAt(zfd, cen, bufsize, cenpos) == -1) goto Catch;
censize = CENSIZE(cen);
@@ -1256,6 +1256,9 @@
* file had been previously locked with ZIP_Lock(). Returns the
* number of bytes read, or -1 if an error occurred. If zip->msg != 0
* then a zip error occurred and zip->msg contains the error text.
+ *
+ * The current implementation does not support reading an entry that
+ * has the size bigger than 2**32 bytes in ONE invocation.
*/
jint
ZIP_Read(jzfile *zip, jzentry *entry, jlong pos, void *buf, jint len)
@@ -1276,7 +1279,7 @@
if (len <= 0)
return 0;
if (len > entry_size - pos)
- len = entry_size - pos;
+ len = (jint)(entry_size - pos);
/* Get file offset to start reading data */
start = ZIP_GetEntryDataOffset(zip, entry);
@@ -1306,6 +1309,9 @@
* from ZIP/JAR files specified in the class path. It is defined here
* so that it can be dynamically loaded by the runtime if the zip library
* is found.
+ *
+ * The current implementation does not support reading an entry that
+ * has the size bigger than 2**32 bytes in ONE invocation.
*/
jboolean
InflateFully(jzfile *zip, jzentry *entry, void *buf, char **msg)
@@ -1314,7 +1320,6 @@
char tmp[BUF_SIZE];
jlong pos = 0;
jlong count = entry->csize;
- jboolean status;
*msg = 0; /* Reset error message */
@@ -1330,10 +1335,10 @@
}
strm.next_out = buf;
- strm.avail_out = entry->size;
+ strm.avail_out = (uInt)entry->size;
while (count > 0) {
- jint n = count > (jlong)sizeof(tmp) ? (jint)sizeof(tmp) : count;
+ jint n = count > (jlong)sizeof(tmp) ? (jint)sizeof(tmp) : (jint)count;
ZIP_Lock(zip);
n = ZIP_Read(zip, entry, pos, tmp, n);
ZIP_Unlock(zip);
@@ -1368,12 +1373,16 @@
return JNI_TRUE;
}
+/*
+ * The current implementation does not support reading an entry that
+ * has the size bigger than 2**32 bytes in ONE invocation.
+ */
jzentry * JNICALL
ZIP_FindEntry(jzfile *zip, char *name, jint *sizeP, jint *nameLenP)
{
jzentry *entry = ZIP_GetEntry(zip, name, 0);
if (entry) {
- *sizeP = entry->size;
+ *sizeP = (jint)entry->size;
*nameLenP = strlen(entry->name);
}
return entry;
--- a/jdk/src/share/native/java/util/zip/zlib-1.2.3/compress.c Fri Nov 19 10:00:08 2010 -0800
+++ b/jdk/src/share/native/java/util/zip/zlib-1.2.3/compress.c Fri Nov 19 12:55:42 2010 -0800
@@ -75,7 +75,7 @@
deflateEnd(&stream);
return err == Z_OK ? Z_BUF_ERROR : err;
}
- *destLen = stream.total_out;
+ *destLen = (uLong)stream.total_out;
err = deflateEnd(&stream);
return err;
--- a/jdk/src/share/native/java/util/zip/zlib-1.2.3/uncompr.c Fri Nov 19 10:00:08 2010 -0800
+++ b/jdk/src/share/native/java/util/zip/zlib-1.2.3/uncompr.c Fri Nov 19 12:55:42 2010 -0800
@@ -78,7 +78,7 @@
return Z_DATA_ERROR;
return err;
}
- *destLen = stream.total_out;
+ *destLen = (uLong)stream.total_out;
err = inflateEnd(&stream);
return err;