提交 67b7c88d 编写于 作者: K ksrini

6989469: (launcher) compiler warnings in jli native code

Reviewed-by: darcy, ohair, sherman
上级 da4da995
...@@ -355,7 +355,6 @@ JavaMain(void * _args) ...@@ -355,7 +355,6 @@ JavaMain(void * _args)
JavaVM *vm = 0; JavaVM *vm = 0;
JNIEnv *env = 0; JNIEnv *env = 0;
jstring mainClassName;
jclass mainClass; jclass mainClass;
jmethodID mainID; jmethodID mainID;
jobjectArray mainArgs; jobjectArray mainArgs;
......
...@@ -72,7 +72,7 @@ inflate_file(int fd, zentry *entry, int *size_out) ...@@ -72,7 +72,7 @@ inflate_file(int fd, zentry *entry, int *size_out)
if (entry->how == STORED) { if (entry->how == STORED) {
*(char *)((size_t)in + entry->csize) = '\0'; *(char *)((size_t)in + entry->csize) = '\0';
if (size_out) { if (size_out) {
*size_out = entry->csize; *size_out = (int)entry->csize;
} }
return (in); return (in);
} else if (entry->how == DEFLATED) { } else if (entry->how == DEFLATED) {
...@@ -103,7 +103,7 @@ inflate_file(int fd, zentry *entry, int *size_out) ...@@ -103,7 +103,7 @@ inflate_file(int fd, zentry *entry, int *size_out)
return (NULL); return (NULL);
} }
if (size_out) { if (size_out) {
*size_out = entry->isize; *size_out = (int)entry->isize;
} }
return (out); return (out);
} else } else
...@@ -317,7 +317,7 @@ find_file(int fd, zentry *entry, const char *file_name) ...@@ -317,7 +317,7 @@ find_file(int fd, zentry *entry, const char *file_name)
* manifest. If so, build the entry record from the data found in * manifest. If so, build the entry record from the data found in
* the header located and return success. * the header located and return success.
*/ */
if (CENNAM(p) == JLI_StrLen(file_name) && if ((size_t)CENNAM(p) == JLI_StrLen(file_name) &&
memcmp((p + CENHDR), file_name, JLI_StrLen(file_name)) == 0) { memcmp((p + CENHDR), file_name, JLI_StrLen(file_name)) == 0) {
if (lseek(fd, base_offset + CENOFF(p), SEEK_SET) < (off_t)0) { if (lseek(fd, base_offset + CENOFF(p), SEEK_SET) < (off_t)0) {
free(buffer); free(buffer);
...@@ -606,8 +606,5 @@ JLI_ManifestIterate(const char *jarfile, attribute_closure ac, void *user_data) ...@@ -606,8 +606,5 @@ JLI_ManifestIterate(const char *jarfile, attribute_closure ac, void *user_data)
} }
free(mp); free(mp);
close(fd); close(fd);
if (rc == 0) return (rc == 0) ? 0 : -2;
return (0);
else
return (-2);
} }
...@@ -290,12 +290,12 @@ FileList_join(FileList fl, char sep) ...@@ -290,12 +290,12 @@ FileList_join(FileList fl, char sep)
char *path; char *path;
char *p; char *p;
for (i = 0, size = 1; i < fl->size; i++) for (i = 0, size = 1; i < fl->size; i++)
size += JLI_StrLen(fl->files[i]) + 1; size += (int)JLI_StrLen(fl->files[i]) + 1;
path = JLI_MemAlloc(size); path = JLI_MemAlloc(size);
for (i = 0, p = path; i < fl->size; i++) { for (i = 0, p = path; i < fl->size; i++) {
int len = JLI_StrLen(fl->files[i]); int len = (int)JLI_StrLen(fl->files[i]);
if (i > 0) *p++ = sep; if (i > 0) *p++ = sep;
memcpy(p, fl->files[i], len); memcpy(p, fl->files[i], len);
p += len; p += len;
...@@ -309,7 +309,7 @@ static FileList ...@@ -309,7 +309,7 @@ static FileList
FileList_split(const char *path, char sep) FileList_split(const char *path, char sep)
{ {
const char *p, *q; const char *p, *q;
int len = JLI_StrLen(path); int len = (int)JLI_StrLen(path);
int count; int count;
FileList fl; FileList fl;
for (count = 1, p = path; p < path + len; p++) for (count = 1, p = path; p < path + len; p++)
...@@ -330,7 +330,7 @@ FileList_split(const char *path, char sep) ...@@ -330,7 +330,7 @@ FileList_split(const char *path, char sep)
static int static int
isJarFileName(const char *filename) isJarFileName(const char *filename)
{ {
int len = JLI_StrLen(filename); int len = (int)JLI_StrLen(filename);
return (len >= 4) && return (len >= 4) &&
(filename[len - 4] == '.') && (filename[len - 4] == '.') &&
(equal(filename + len - 3, "jar") || (equal(filename + len - 3, "jar") ||
...@@ -342,8 +342,8 @@ isJarFileName(const char *filename) ...@@ -342,8 +342,8 @@ isJarFileName(const char *filename)
static char * static char *
wildcardConcat(const char *wildcard, const char *basename) wildcardConcat(const char *wildcard, const char *basename)
{ {
int wildlen = JLI_StrLen(wildcard); int wildlen = (int)JLI_StrLen(wildcard);
int baselen = JLI_StrLen(basename); int baselen = (int)JLI_StrLen(basename);
char *filename = (char *) JLI_MemAlloc(wildlen + baselen); char *filename = (char *) JLI_MemAlloc(wildlen + baselen);
/* Replace the trailing '*' with basename */ /* Replace the trailing '*' with basename */
memcpy(filename, wildcard, wildlen-1); memcpy(filename, wildcard, wildlen-1);
...@@ -369,7 +369,7 @@ wildcardFileList(const char *wildcard) ...@@ -369,7 +369,7 @@ wildcardFileList(const char *wildcard)
static int static int
isWildcard(const char *filename) isWildcard(const char *filename)
{ {
int len = JLI_StrLen(filename); int len = (int)JLI_StrLen(filename);
return (len > 0) && return (len > 0) &&
(filename[len - 1] == '*') && (filename[len - 1] == '*') &&
(len == 1 || IS_FILE_SEPARATOR(filename[len - 2])) && (len == 1 || IS_FILE_SEPARATOR(filename[len - 2])) &&
......
...@@ -406,7 +406,7 @@ uLong ZEXPORT crc32_combine(crc1, crc2, len2) ...@@ -406,7 +406,7 @@ uLong ZEXPORT crc32_combine(crc1, crc2, len2)
return crc1; return crc1;
/* put operator for one zero bit in odd */ /* put operator for one zero bit in odd */
odd[0] = 0xedb88320L; /* CRC-32 polynomial */ odd[0] = 0xedb88320UL; /* CRC-32 polynomial */
row = 1; row = 1;
for (n = 1; n < GF2_DIM; n++) { for (n = 1; n < GF2_DIM; n++) {
odd[n] = row; odd[n] = row;
......
...@@ -868,7 +868,7 @@ LocateJRE(manifest_info* info) ...@@ -868,7 +868,7 @@ LocateJRE(manifest_info* info)
while (dp != NULL) { while (dp != NULL) {
cp = JLI_StrChr(dp, (int)':'); cp = JLI_StrChr(dp, (int)':');
if (cp != NULL) if (cp != NULL)
*cp = (char)NULL; *cp = '\0';
if ((target = ProcessDir(info, dp)) != NULL) if ((target = ProcessDir(info, dp)) != NULL)
break; break;
dp = cp; dp = cp;
......
...@@ -221,6 +221,7 @@ int main(int argc, const char * argv[]) { ...@@ -221,6 +221,7 @@ int main(int argc, const char * argv[]) {
* implies an error in the exec. */ * implies an error in the exec. */
free(nargv); free(nargv);
errorExit(errno, BAD_EXEC_MSG); errorExit(errno, BAD_EXEC_MSG);
return 0; // keep the compiler happy
} }
......
...@@ -208,7 +208,7 @@ EnsureJreInstallation(const char* jrepath) ...@@ -208,7 +208,7 @@ EnsureJreInstallation(const char* jrepath)
struct stat s; struct stat s;
/* Make sure the jrepath contains something */ /* Make sure the jrepath contains something */
if (jrepath[0] == NULL) { if ((void*)jrepath[0] == NULL) {
return; return;
} }
/* 32 bit windows only please */ /* 32 bit windows only please */
...@@ -540,7 +540,7 @@ JLI_ReportErrorMessageSys(const char *fmt, ...) ...@@ -540,7 +540,7 @@ JLI_ReportErrorMessageSys(const char *fmt, ...)
/* get the length of the string we need */ /* get the length of the string we need */
int len = mlen = _vscprintf(fmt, vl) + 1; int len = mlen = _vscprintf(fmt, vl) + 1;
if (freeit) { if (freeit) {
mlen += JLI_StrLen(errtext); mlen += (int)JLI_StrLen(errtext);
} }
message = (char *)JLI_MemAlloc(mlen); message = (char *)JLI_MemAlloc(mlen);
...@@ -997,7 +997,6 @@ ExecJRE(char *jre, char **argv) { ...@@ -997,7 +997,6 @@ ExecJRE(char *jre, char **argv) {
exit(exitCode); exit(exitCode);
} }
} }
/* /*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册