Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion jdk/src/macosx/bin/java_md_macosx.c
Original file line number Diff line number Diff line change
Expand Up @@ -881,7 +881,7 @@ ContinueInNewThread0(int (JNICALL *continuation)(void *), jlong stack_size, void
if (pthread_create(&tid, &attr, (void *(*)(void*))continuation, (void*)args) == 0) {
void * tmp;
pthread_join(tid, &tmp);
rslt = (int)tmp;
rslt = (int)(intptr_t)tmp;
} else {
/*
* Continue execution in current thread if for some reason (e.g. out of
Expand Down
2 changes: 1 addition & 1 deletion jdk/src/share/bin/java.c
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,7 @@ SetJvmEnvironment(int argc, char **argv) {
static int
parse_size(const char *s, jlong *result) {
jlong n = 0;
int args_read = sscanf(s, jlong_format_specifier(), &n);
int args_read = sscanf(s, JLONG_FORMAT_SPECIFIER, &n);
if (args_read != 1) {
return 0;
}
Expand Down
2 changes: 0 additions & 2 deletions jdk/src/share/bin/java.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,6 @@ void JLI_ReportMessage(const char * message, ...);
void JLI_ReportExceptionDescription(JNIEnv * env);
void PrintMachineDependentOptions();

const char *jlong_format_specifier();

/*
* Block current thread and continue execution in new thread
*/
Expand Down
16 changes: 11 additions & 5 deletions jdk/src/share/bin/parse_manifest.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2013, 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
Expand Down Expand Up @@ -174,7 +174,7 @@ find_end(int fd, Byte *eb)
*/
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 (GETSIG(eb) == ENDSIG) {
return haveZIP64(eb) ? find_end64(fd, eb, pos) : pos;
Expand All @@ -193,7 +193,13 @@ find_end(int fd, Byte *eb)
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);
}
Expand Down Expand Up @@ -577,7 +583,7 @@ JLI_ParseManifest(char *jarfile, manifest_info *info)
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);
}
Expand Down Expand Up @@ -677,7 +683,7 @@ JLI_ManifestIterate(const char *jarfile, attribute_closure ac, void *user_data)
return (-1);
}

if (rc = find_file(fd, &entry, manifest_name) != 0) {
if ((rc = find_file(fd, &entry, manifest_name)) != 0) {
close(fd);
return (-2);
}
Expand Down
8 changes: 4 additions & 4 deletions jdk/src/share/bin/splashscreen_stubs.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 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
Expand Down Expand Up @@ -61,11 +61,11 @@ typedef char* (*SplashGetScaledImageName_t)(const char* fileName,
#define INVOKEV(name) _INVOKE(name, ,;)

int DoSplashLoadMemory(void* pdata, int size) {
INVOKE(SplashLoadMemory, NULL)(pdata, size);
INVOKE(SplashLoadMemory, 0)(pdata, size);
}

int DoSplashLoadFile(const char* filename) {
INVOKE(SplashLoadFile, NULL)(filename);
INVOKE(SplashLoadFile, 0)(filename);
}

void DoSplashInit(void) {
Expand All @@ -87,4 +87,4 @@ void DoSplashSetScaleFactor(float scaleFactor) {
char* DoSplashGetScaledImageName(const char* fileName, const char* jarName,
float* scaleFactor) {
INVOKE(SplashGetScaledImageName, NULL)(fileName, jarName, scaleFactor);
}
}
6 changes: 3 additions & 3 deletions jdk/src/share/bin/wildcard.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 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
Expand Down Expand Up @@ -274,7 +274,7 @@ FileList_add(FileList fl, char *file)
}

static void
FileList_addSubstring(FileList fl, const char *beg, int len)
FileList_addSubstring(FileList fl, const char *beg, size_t len)
{
char *filename = (char *) JLI_MemAlloc(len+1);
memcpy(filename, beg, len);
Expand Down Expand Up @@ -310,7 +310,7 @@ static FileList
FileList_split(const char *path, char sep)
{
const char *p, *q;
int len = (int)JLI_StrLen(path);
size_t len = JLI_StrLen(path);
int count;
FileList fl;
for (count = 1, p = path; p < path + len; p++)
Expand Down
8 changes: 7 additions & 1 deletion jdk/src/solaris/bin/java_md.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 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
Expand Down Expand Up @@ -43,6 +43,12 @@
#define MAXNAMELEN PATH_MAX
#endif

#ifdef _LP64
#define JLONG_FORMAT_SPECIFIER "%ld"
#else
#define JLONG_FORMAT_SPECIFIER "%lld"
#endif

/*
* Common function prototypes and sundries.
*/
Expand Down
7 changes: 1 addition & 6 deletions jdk/src/solaris/bin/java_md_common.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 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
Expand Down Expand Up @@ -463,11 +463,6 @@ UnsetEnv(char *name)
return(borrowed_unsetenv(name));
}

const char *
jlong_format_specifier() {
return "%lld";
}

jboolean
IsJavaw()
{
Expand Down
4 changes: 2 additions & 2 deletions jdk/src/solaris/bin/java_md_solinux.c
Original file line number Diff line number Diff line change
Expand Up @@ -1043,7 +1043,7 @@ ContinueInNewThread0(int (JNICALL *continuation)(void *), jlong stack_size, void
if (pthread_create(&tid, &attr, (void *(*)(void*))continuation, (void*)args) == 0) {
void * tmp;
pthread_join(tid, &tmp);
rslt = (int)tmp;
rslt = (int)(intptr_t)tmp;
} else {
/*
* Continue execution in current thread if for some reason (e.g. out of
Expand All @@ -1061,7 +1061,7 @@ ContinueInNewThread0(int (JNICALL *continuation)(void *), jlong stack_size, void
if (thr_create(NULL, stack_size, (void *(*)(void *))continuation, args, flags, &tid) == 0) {
void * tmp;
thr_join(tid, NULL, &tmp);
rslt = (int)tmp;
rslt = (int)(intptr_t)tmp;
} else {
/* See above. Continue in current thread if thr_create() failed */
rslt = continuation(args);
Expand Down
8 changes: 5 additions & 3 deletions jdk/src/windows/bin/cmdtoargs.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 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
Expand Down Expand Up @@ -77,7 +77,7 @@ static char* next_arg(char* cmdline, char* arg, jboolean* wildcard) {
USHORT ch = 0;
int i;
jboolean done = JNI_FALSE;
int charLength;
ptrdiff_t charLength;

*wildcard = JNI_FALSE;
while (!done) {
Expand Down Expand Up @@ -209,10 +209,12 @@ void JLI_CmdToArgs(char* cmdline) {
argv = (StdArg*) JLI_MemRealloc(argv, (nargs+1) * sizeof(StdArg));
argv[nargs].arg = JLI_StringDup(arg);
argv[nargs].has_wildcard = wildcard;
*arg = NULL;
*arg = '\0';
nargs++;
} while (src != NULL);

JLI_MemFree(arg);

stdargc = nargs;
stdargs = argv;
}
Expand Down
14 changes: 5 additions & 9 deletions jdk/src/windows/bin/java_md.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ int awtPreloadD3D = -1;
* GetParamValue("theParam", "theParam=value") returns pointer to "value".
*/
const char * GetParamValue(const char *paramName, const char *arg) {
int nameLen = JLI_StrLen(paramName);
size_t nameLen = JLI_StrLen(paramName);
if (JLI_StrNCmp(paramName, arg, nameLen) == 0) {
/* arg[nameLen] is valid (may contain final NULL) */
if (arg[nameLen] == '=') {
Expand Down Expand Up @@ -583,7 +583,7 @@ JLI_Snprintf(char* buffer, size_t size, const char* format, ...) {
if (rc < 0) {
/* apply ansi semantics */
buffer[size - 1] = '\0';
return size;
return (int)size;
} else if (rc == size) {
/* force a null terminator */
buffer[size - 1] = '\0';
Expand Down Expand Up @@ -1164,11 +1164,6 @@ void SplashFreeLibrary() {
}
}

const char *
jlong_format_specifier() {
return "%I64d";
}

/*
* Block current thread and continue execution in a new thread
*/
Expand Down Expand Up @@ -1318,7 +1313,7 @@ int AWTPreload(const char *funcName)
if (hPreloadAwt == NULL) {
/* awt.dll is not loaded yet */
char libraryPath[MAXPATHLEN];
int jrePathLen = 0;
size_t jrePathLen = 0;
HMODULE hJava = NULL;
HMODULE hVerify = NULL;

Expand Down Expand Up @@ -1460,7 +1455,8 @@ filterArgs(StdArg *stdargs, const int nargc, StdArg **pargv) {
jobjectArray
CreateApplicationArgs(JNIEnv *env, char **strv, int argc)
{
int i, j, idx, tlen;
int i, j, idx;
size_t tlen;
jobjectArray outArray, inArray;
char *ostart, *astart, **nargv;
jboolean needs_expansion = JNI_FALSE;
Expand Down
3 changes: 2 additions & 1 deletion jdk/src/windows/bin/java_md.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 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
Expand Down Expand Up @@ -39,6 +39,7 @@
#define MAXPATHLEN MAX_PATH
#define MAXNAMELEN MAX_PATH

#define JLONG_FORMAT_SPECIFIER "%I64d"

/*
* Support for doing cheap, accurate interval timing.
Expand Down