6989466: Miscellaneous compiler warnings in java/lang, java/util, java/io, sun/misc native code
Reviewed-by: andrew, mchung, ohair
This commit is contained in:
parent
1550d01979
commit
14a7edc2ad
@ -76,7 +76,7 @@ JDK_GetVersionInfo0(jdk_version_info* info, size_t info_size) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
memset(info, 0, sizeof(info_size));
|
memset(info, 0, info_size);
|
||||||
info->jdk_version = ((jdk_major_version & 0xFF) << 24) |
|
info->jdk_version = ((jdk_major_version & 0xFF) << 24) |
|
||||||
((jdk_minor_version & 0xFF) << 16) |
|
((jdk_minor_version & 0xFF) << 16) |
|
||||||
((jdk_micro_version & 0xFF) << 8) |
|
((jdk_micro_version & 0xFF) << 8) |
|
||||||
|
@ -433,7 +433,7 @@ getString8859_1Chars(JNIEnv *env, jstring jstr)
|
|||||||
for (i=0; i<len; i++) {
|
for (i=0; i<len; i++) {
|
||||||
jchar unicode = str[i];
|
jchar unicode = str[i];
|
||||||
if (unicode <= 0x00ff)
|
if (unicode <= 0x00ff)
|
||||||
result[i] = unicode;
|
result[i] = (char)unicode;
|
||||||
else
|
else
|
||||||
result[i] = '?';
|
result[i] = '?';
|
||||||
}
|
}
|
||||||
@ -498,7 +498,7 @@ getString646_USChars(JNIEnv *env, jstring jstr)
|
|||||||
for (i=0; i<len; i++) {
|
for (i=0; i<len; i++) {
|
||||||
jchar unicode = str[i];
|
jchar unicode = str[i];
|
||||||
if (unicode <= 0x007f )
|
if (unicode <= 0x007f )
|
||||||
result[i] = unicode;
|
result[i] = (char)unicode;
|
||||||
else
|
else
|
||||||
result[i] = '?';
|
result[i] = '?';
|
||||||
}
|
}
|
||||||
@ -569,7 +569,7 @@ getStringCp1252Chars(JNIEnv *env, jstring jstr)
|
|||||||
for (i=0; i<len; i++) {
|
for (i=0; i<len; i++) {
|
||||||
jchar c = str[i];
|
jchar c = str[i];
|
||||||
if (c < 256)
|
if (c < 256)
|
||||||
result[i] = c;
|
result[i] = (char)c;
|
||||||
else switch(c) {
|
else switch(c) {
|
||||||
case 0x20AC: result[i] = (char)0x80; break;
|
case 0x20AC: result[i] = (char)0x80; break;
|
||||||
case 0x201A: result[i] = (char)0x82; break;
|
case 0x201A: result[i] = (char)0x82; break;
|
||||||
|
@ -102,8 +102,8 @@ Java_java_lang_Class_forName0(JNIEnv *env, jclass this, jstring classname,
|
|||||||
char *clname;
|
char *clname;
|
||||||
jclass cls = 0;
|
jclass cls = 0;
|
||||||
char buf[128];
|
char buf[128];
|
||||||
int len;
|
jsize len;
|
||||||
int unicode_len;
|
jsize unicode_len;
|
||||||
|
|
||||||
if (classname == NULL) {
|
if (classname == NULL) {
|
||||||
JNU_ThrowNullPointerException(env, 0);
|
JNU_ThrowNullPointerException(env, 0);
|
||||||
@ -112,7 +112,7 @@ Java_java_lang_Class_forName0(JNIEnv *env, jclass this, jstring classname,
|
|||||||
|
|
||||||
len = (*env)->GetStringUTFLength(env, classname);
|
len = (*env)->GetStringUTFLength(env, classname);
|
||||||
unicode_len = (*env)->GetStringLength(env, classname);
|
unicode_len = (*env)->GetStringLength(env, classname);
|
||||||
if (len >= sizeof(buf)) {
|
if (len >= (jsize)sizeof(buf)) {
|
||||||
clname = malloc(len + 1);
|
clname = malloc(len + 1);
|
||||||
if (clname == NULL) {
|
if (clname == NULL) {
|
||||||
JNU_ThrowOutOfMemoryError(env, NULL);
|
JNU_ThrowOutOfMemoryError(env, NULL);
|
||||||
|
@ -331,7 +331,7 @@ Java_java_lang_ClassLoader_00024NativeLibrary_load
|
|||||||
if (handle) {
|
if (handle) {
|
||||||
const char *onLoadSymbols[] = JNI_ONLOAD_SYMBOLS;
|
const char *onLoadSymbols[] = JNI_ONLOAD_SYMBOLS;
|
||||||
JNI_OnLoad_t JNI_OnLoad;
|
JNI_OnLoad_t JNI_OnLoad;
|
||||||
int i;
|
unsigned int i;
|
||||||
for (i = 0; i < sizeof(onLoadSymbols) / sizeof(char *); i++) {
|
for (i = 0; i < sizeof(onLoadSymbols) / sizeof(char *); i++) {
|
||||||
JNI_OnLoad = (JNI_OnLoad_t)
|
JNI_OnLoad = (JNI_OnLoad_t)
|
||||||
JVM_FindLibraryEntry(handle, onLoadSymbols[i]);
|
JVM_FindLibraryEntry(handle, onLoadSymbols[i]);
|
||||||
@ -369,7 +369,7 @@ Java_java_lang_ClassLoader_00024NativeLibrary_load
|
|||||||
cause = (*env)->ExceptionOccurred(env);
|
cause = (*env)->ExceptionOccurred(env);
|
||||||
if (cause) {
|
if (cause) {
|
||||||
(*env)->ExceptionClear(env);
|
(*env)->ExceptionClear(env);
|
||||||
(*env)->SetLongField(env, this, handleID, (jlong)NULL);
|
(*env)->SetLongField(env, this, handleID, (jlong)0);
|
||||||
(*env)->Throw(env, cause);
|
(*env)->Throw(env, cause);
|
||||||
}
|
}
|
||||||
goto done;
|
goto done;
|
||||||
@ -392,7 +392,7 @@ Java_java_lang_ClassLoader_00024NativeLibrary_unload
|
|||||||
const char *onUnloadSymbols[] = JNI_ONUNLOAD_SYMBOLS;
|
const char *onUnloadSymbols[] = JNI_ONUNLOAD_SYMBOLS;
|
||||||
void *handle;
|
void *handle;
|
||||||
JNI_OnUnload_t JNI_OnUnload;
|
JNI_OnUnload_t JNI_OnUnload;
|
||||||
int i;
|
unsigned int i;
|
||||||
|
|
||||||
if (!initIDs(env))
|
if (!initIDs(env))
|
||||||
return;
|
return;
|
||||||
|
@ -109,7 +109,7 @@ Java_java_lang_System_identityHashCode(JNIEnv *env, jobject this, jobject x)
|
|||||||
#error "ERROR: No override of JAVA_SPECIFICATION_VENDOR is allowed"
|
#error "ERROR: No override of JAVA_SPECIFICATION_VENDOR is allowed"
|
||||||
#else
|
#else
|
||||||
#define JAVA_SPECIFICATION_VENDOR "Oracle Corporation"
|
#define JAVA_SPECIFICATION_VENDOR "Oracle Corporation"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int fmtdefault; // boolean value
|
static int fmtdefault; // boolean value
|
||||||
jobject fillI18nProps(JNIEnv *env, jobject props, char *baseKey,
|
jobject fillI18nProps(JNIEnv *env, jobject props, char *baseKey,
|
||||||
|
@ -46,11 +46,13 @@
|
|||||||
#define __LOp(x) *(1+(int*)x)
|
#define __LOp(x) *(1+(int*)x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef __P
|
||||||
#ifdef __STDC__
|
#ifdef __STDC__
|
||||||
#define __P(p) p
|
#define __P(p) p
|
||||||
#else
|
#else
|
||||||
#define __P(p) ()
|
#define __P(p) ()
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ANSI/POSIX
|
* ANSI/POSIX
|
||||||
|
@ -82,9 +82,9 @@ Java_java_lang_reflect_Proxy_defineClass0(JNIEnv *env,
|
|||||||
goto free_body;
|
goto free_body;
|
||||||
|
|
||||||
if (name != NULL) {
|
if (name != NULL) {
|
||||||
int len = (*env)->GetStringUTFLength(env, name);
|
jsize len = (*env)->GetStringUTFLength(env, name);
|
||||||
int unicode_len = (*env)->GetStringLength(env, name);
|
jsize unicode_len = (*env)->GetStringLength(env, name);
|
||||||
if (len >= sizeof(buf)) {
|
if (len >= (jsize)sizeof(buf)) {
|
||||||
utfName = malloc(len + 1);
|
utfName = malloc(len + 1);
|
||||||
if (utfName == NULL) {
|
if (utfName == NULL) {
|
||||||
JNU_ThrowOutOfMemoryError(env, NULL);
|
JNU_ThrowOutOfMemoryError(env, NULL);
|
||||||
|
@ -72,7 +72,7 @@ Java_java_nio_Bits_copyFromShortArray(JNIEnv *env, jobject this, jobject src,
|
|||||||
jlong srcPos, jlong dstAddr, jlong length)
|
jlong srcPos, jlong dstAddr, jlong length)
|
||||||
{
|
{
|
||||||
jbyte *bytes;
|
jbyte *bytes;
|
||||||
size_t i, size;
|
size_t size;
|
||||||
jshort *srcShort, *dstShort, *endShort;
|
jshort *srcShort, *dstShort, *endShort;
|
||||||
jshort tmpShort;
|
jshort tmpShort;
|
||||||
|
|
||||||
@ -83,7 +83,7 @@ Java_java_nio_Bits_copyFromShortArray(JNIEnv *env, jobject this, jobject src,
|
|||||||
if (length > MBYTE)
|
if (length > MBYTE)
|
||||||
size = MBYTE;
|
size = MBYTE;
|
||||||
else
|
else
|
||||||
size = length;
|
size = (size_t)length;
|
||||||
|
|
||||||
GETCRITICAL(bytes, env, src);
|
GETCRITICAL(bytes, env, src);
|
||||||
|
|
||||||
@ -107,7 +107,7 @@ Java_java_nio_Bits_copyToShortArray(JNIEnv *env, jobject this, jlong srcAddr,
|
|||||||
jobject dst, jlong dstPos, jlong length)
|
jobject dst, jlong dstPos, jlong length)
|
||||||
{
|
{
|
||||||
jbyte *bytes;
|
jbyte *bytes;
|
||||||
size_t i, size;
|
size_t size;
|
||||||
jshort *srcShort, *dstShort, *endShort;
|
jshort *srcShort, *dstShort, *endShort;
|
||||||
jshort tmpShort;
|
jshort tmpShort;
|
||||||
|
|
||||||
@ -118,7 +118,7 @@ Java_java_nio_Bits_copyToShortArray(JNIEnv *env, jobject this, jlong srcAddr,
|
|||||||
if (length > MBYTE)
|
if (length > MBYTE)
|
||||||
size = MBYTE;
|
size = MBYTE;
|
||||||
else
|
else
|
||||||
size = length;
|
size = (size_t)length;
|
||||||
|
|
||||||
GETCRITICAL(bytes, env, dst);
|
GETCRITICAL(bytes, env, dst);
|
||||||
|
|
||||||
@ -142,7 +142,7 @@ Java_java_nio_Bits_copyFromIntArray(JNIEnv *env, jobject this, jobject src,
|
|||||||
jlong srcPos, jlong dstAddr, jlong length)
|
jlong srcPos, jlong dstAddr, jlong length)
|
||||||
{
|
{
|
||||||
jbyte *bytes;
|
jbyte *bytes;
|
||||||
size_t i, size;
|
size_t size;
|
||||||
jint *srcInt, *dstInt, *endInt;
|
jint *srcInt, *dstInt, *endInt;
|
||||||
jint tmpInt;
|
jint tmpInt;
|
||||||
|
|
||||||
@ -153,7 +153,7 @@ Java_java_nio_Bits_copyFromIntArray(JNIEnv *env, jobject this, jobject src,
|
|||||||
if (length > MBYTE)
|
if (length > MBYTE)
|
||||||
size = MBYTE;
|
size = MBYTE;
|
||||||
else
|
else
|
||||||
size = length;
|
size = (size_t)length;
|
||||||
|
|
||||||
GETCRITICAL(bytes, env, src);
|
GETCRITICAL(bytes, env, src);
|
||||||
|
|
||||||
@ -177,7 +177,7 @@ Java_java_nio_Bits_copyToIntArray(JNIEnv *env, jobject this, jlong srcAddr,
|
|||||||
jobject dst, jlong dstPos, jlong length)
|
jobject dst, jlong dstPos, jlong length)
|
||||||
{
|
{
|
||||||
jbyte *bytes;
|
jbyte *bytes;
|
||||||
size_t i, size;
|
size_t size;
|
||||||
jint *srcInt, *dstInt, *endInt;
|
jint *srcInt, *dstInt, *endInt;
|
||||||
jint tmpInt;
|
jint tmpInt;
|
||||||
|
|
||||||
@ -188,7 +188,7 @@ Java_java_nio_Bits_copyToIntArray(JNIEnv *env, jobject this, jlong srcAddr,
|
|||||||
if (length > MBYTE)
|
if (length > MBYTE)
|
||||||
size = MBYTE;
|
size = MBYTE;
|
||||||
else
|
else
|
||||||
size = length;
|
size = (size_t)length;
|
||||||
|
|
||||||
GETCRITICAL(bytes, env, dst);
|
GETCRITICAL(bytes, env, dst);
|
||||||
|
|
||||||
@ -212,7 +212,7 @@ Java_java_nio_Bits_copyFromLongArray(JNIEnv *env, jobject this, jobject src,
|
|||||||
jlong srcPos, jlong dstAddr, jlong length)
|
jlong srcPos, jlong dstAddr, jlong length)
|
||||||
{
|
{
|
||||||
jbyte *bytes;
|
jbyte *bytes;
|
||||||
size_t i, size;
|
size_t size;
|
||||||
jlong *srcLong, *dstLong, *endLong;
|
jlong *srcLong, *dstLong, *endLong;
|
||||||
jlong tmpLong;
|
jlong tmpLong;
|
||||||
|
|
||||||
@ -223,7 +223,7 @@ Java_java_nio_Bits_copyFromLongArray(JNIEnv *env, jobject this, jobject src,
|
|||||||
if (length > MBYTE)
|
if (length > MBYTE)
|
||||||
size = MBYTE;
|
size = MBYTE;
|
||||||
else
|
else
|
||||||
size = length;
|
size = (size_t)length;
|
||||||
|
|
||||||
GETCRITICAL(bytes, env, src);
|
GETCRITICAL(bytes, env, src);
|
||||||
|
|
||||||
@ -247,7 +247,7 @@ Java_java_nio_Bits_copyToLongArray(JNIEnv *env, jobject this, jlong srcAddr,
|
|||||||
jobject dst, jlong dstPos, jlong length)
|
jobject dst, jlong dstPos, jlong length)
|
||||||
{
|
{
|
||||||
jbyte *bytes;
|
jbyte *bytes;
|
||||||
size_t i, size;
|
size_t size;
|
||||||
jlong *srcLong, *dstLong, *endLong;
|
jlong *srcLong, *dstLong, *endLong;
|
||||||
jlong tmpLong;
|
jlong tmpLong;
|
||||||
|
|
||||||
@ -258,7 +258,7 @@ Java_java_nio_Bits_copyToLongArray(JNIEnv *env, jobject this, jlong srcAddr,
|
|||||||
if (length > MBYTE)
|
if (length > MBYTE)
|
||||||
size = MBYTE;
|
size = MBYTE;
|
||||||
else
|
else
|
||||||
size = length;
|
size = (size_t)length;
|
||||||
|
|
||||||
GETCRITICAL(bytes, env, dst);
|
GETCRITICAL(bytes, env, dst);
|
||||||
|
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
#include <jni.h>
|
#include <jni.h>
|
||||||
#include "management.h"
|
#include "management.h"
|
||||||
#include "sun_management_Flag.h"
|
#include "sun_management_Flag.h"
|
||||||
@ -80,8 +81,6 @@ JNIEXPORT jint JNICALL
|
|||||||
Java_sun_management_Flag_getFlags
|
Java_sun_management_Flag_getFlags
|
||||||
(JNIEnv *env, jclass cls, jobjectArray names, jobjectArray flags, jint count)
|
(JNIEnv *env, jclass cls, jobjectArray names, jobjectArray flags, jint count)
|
||||||
{
|
{
|
||||||
char errmsg[128];
|
|
||||||
|
|
||||||
jint num_flags, i, index;
|
jint num_flags, i, index;
|
||||||
jmmVMGlobal* globals;
|
jmmVMGlobal* globals;
|
||||||
size_t gsize;
|
size_t gsize;
|
||||||
|
@ -23,6 +23,8 @@
|
|||||||
* questions.
|
* questions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#include "jni.h"
|
#include "jni.h"
|
||||||
#include "jni_util.h"
|
#include "jni_util.h"
|
||||||
#include "jlong.h"
|
#include "jlong.h"
|
||||||
@ -113,7 +115,6 @@ typedef void (JNICALL *GetJvmVersionInfo_fp)(JNIEnv*, jvm_version_info*, size_t)
|
|||||||
|
|
||||||
JNIEXPORT void JNICALL
|
JNIEXPORT void JNICALL
|
||||||
Java_sun_misc_VM_initialize(JNIEnv *env, jclass cls) {
|
Java_sun_misc_VM_initialize(JNIEnv *env, jclass cls) {
|
||||||
char errmsg[128];
|
|
||||||
GetJvmVersionInfo_fp func_p;
|
GetJvmVersionInfo_fp func_p;
|
||||||
|
|
||||||
if (!JDK_InitJvmHandle()) {
|
if (!JDK_InitJvmHandle()) {
|
||||||
@ -123,8 +124,6 @@ Java_sun_misc_VM_initialize(JNIEnv *env, jclass cls) {
|
|||||||
|
|
||||||
func_p = (GetJvmVersionInfo_fp) JDK_FindJvmEntry("JVM_GetVersionInfo");
|
func_p = (GetJvmVersionInfo_fp) JDK_FindJvmEntry("JVM_GetVersionInfo");
|
||||||
if (func_p != NULL) {
|
if (func_p != NULL) {
|
||||||
char errmsg[100];
|
|
||||||
jfieldID fid;
|
|
||||||
jvm_version_info info;
|
jvm_version_info info;
|
||||||
|
|
||||||
memset(&info, 0, sizeof(info));
|
memset(&info, 0, sizeof(info));
|
||||||
|
@ -38,8 +38,6 @@ static INIT_AGENT_PROPERTIES_FN InitAgentProperties_fp = NULL;
|
|||||||
JNIEXPORT jobject JNICALL
|
JNIEXPORT jobject JNICALL
|
||||||
Java_sun_misc_VMSupport_initAgentProperties(JNIEnv *env, jclass cls, jobject props)
|
Java_sun_misc_VMSupport_initAgentProperties(JNIEnv *env, jclass cls, jobject props)
|
||||||
{
|
{
|
||||||
char errmsg[128];
|
|
||||||
|
|
||||||
if (InitAgentProperties_fp == NULL) {
|
if (InitAgentProperties_fp == NULL) {
|
||||||
if (!JDK_InitJvmHandle()) {
|
if (!JDK_InitJvmHandle()) {
|
||||||
JNU_ThrowInternalError(env,
|
JNU_ThrowInternalError(env,
|
||||||
|
@ -119,7 +119,7 @@ Java_java_io_UnixFileSystem_checkAccess(JNIEnv *env, jobject this,
|
|||||||
jobject file, jint a)
|
jobject file, jint a)
|
||||||
{
|
{
|
||||||
jboolean rv = JNI_FALSE;
|
jboolean rv = JNI_FALSE;
|
||||||
int mode;
|
int mode = 0;
|
||||||
switch (a) {
|
switch (a) {
|
||||||
case java_io_FileSystem_ACCESS_READ:
|
case java_io_FileSystem_ACCESS_READ:
|
||||||
mode = R_OK;
|
mode = R_OK;
|
||||||
@ -151,7 +151,8 @@ Java_java_io_UnixFileSystem_setPermission(JNIEnv *env, jobject this,
|
|||||||
jboolean rv = JNI_FALSE;
|
jboolean rv = JNI_FALSE;
|
||||||
|
|
||||||
WITH_FIELD_PLATFORM_STRING(env, file, ids.path, path) {
|
WITH_FIELD_PLATFORM_STRING(env, file, ids.path, path) {
|
||||||
int amode, mode;
|
int amode = 0;
|
||||||
|
int mode;
|
||||||
switch (access) {
|
switch (access) {
|
||||||
case java_io_FileSystem_ACCESS_READ:
|
case java_io_FileSystem_ACCESS_READ:
|
||||||
if (owneronly)
|
if (owneronly)
|
||||||
|
@ -246,7 +246,7 @@ canonicalize(char *original, char *resolved, int len)
|
|||||||
if (r != NULL) {
|
if (r != NULL) {
|
||||||
/* Append unresolved subpath to resolved subpath */
|
/* Append unresolved subpath to resolved subpath */
|
||||||
int rn = strlen(r);
|
int rn = strlen(r);
|
||||||
if (rn + strlen(p) >= len) {
|
if (rn + (int)strlen(p) >= len) {
|
||||||
/* Buffer overflow */
|
/* Buffer overflow */
|
||||||
errno = ENAMETOOLONG;
|
errno = ENAMETOOLONG;
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -46,7 +46,9 @@
|
|||||||
#include "java_props.h"
|
#include "java_props.h"
|
||||||
|
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
#define CODESET _NL_CTYPE_CODESET_NAME
|
#ifndef CODESET
|
||||||
|
#define CODESET _NL_CTYPE_CODESET_NAME
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
#ifdef ALT_CODESET_KEY
|
#ifdef ALT_CODESET_KEY
|
||||||
#define CODESET ALT_CODESET_KEY
|
#define CODESET ALT_CODESET_KEY
|
||||||
@ -289,7 +291,7 @@ static int ParseLocale(int cat, char ** std_language, char ** std_country, char
|
|||||||
java_props_t *
|
java_props_t *
|
||||||
GetJavaProperties(JNIEnv *env)
|
GetJavaProperties(JNIEnv *env)
|
||||||
{
|
{
|
||||||
static java_props_t sprops = {0};
|
static java_props_t sprops;
|
||||||
char *v; /* tmp var */
|
char *v; /* tmp var */
|
||||||
|
|
||||||
if (sprops.user_dir) {
|
if (sprops.user_dir) {
|
||||||
|
@ -68,7 +68,7 @@ static int create(JNIEnv* env)
|
|||||||
*/
|
*/
|
||||||
if (ipv6_available()) {
|
if (ipv6_available()) {
|
||||||
JNU_ThrowIOException(env, "IPv6 not supported");
|
JNU_ThrowIOException(env, "IPv6 not supported");
|
||||||
return;
|
return -1;
|
||||||
}
|
}
|
||||||
s = socket(AF_INET_SDP, SOCK_STREAM, 0);
|
s = socket(AF_INET_SDP, SOCK_STREAM, 0);
|
||||||
#else
|
#else
|
||||||
|
@ -298,7 +298,8 @@ Java_sun_nio_ch_Net_getIntOption0(JNIEnv *env, jclass clazz, jobject fdo,
|
|||||||
struct linger linger;
|
struct linger linger;
|
||||||
u_char carg;
|
u_char carg;
|
||||||
void *arg;
|
void *arg;
|
||||||
int arglen, n;
|
socklen_t arglen;
|
||||||
|
int n;
|
||||||
|
|
||||||
/* Option value is an int except for a few specific cases */
|
/* Option value is an int except for a few specific cases */
|
||||||
|
|
||||||
@ -317,7 +318,7 @@ Java_sun_nio_ch_Net_getIntOption0(JNIEnv *env, jclass clazz, jobject fdo,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (mayNeedConversion) {
|
if (mayNeedConversion) {
|
||||||
n = NET_GetSockOpt(fdval(env, fdo), level, opt, arg, &arglen);
|
n = NET_GetSockOpt(fdval(env, fdo), level, opt, arg, (int*)&arglen);
|
||||||
} else {
|
} else {
|
||||||
n = getsockopt(fdval(env, fdo), level, opt, arg, &arglen);
|
n = getsockopt(fdval(env, fdo), level, opt, arg, &arglen);
|
||||||
}
|
}
|
||||||
@ -527,7 +528,7 @@ JNIEXPORT jint JNICALL
|
|||||||
Java_sun_nio_ch_Net_getInterface4(JNIEnv* env, jobject this, jobject fdo)
|
Java_sun_nio_ch_Net_getInterface4(JNIEnv* env, jobject this, jobject fdo)
|
||||||
{
|
{
|
||||||
struct in_addr in;
|
struct in_addr in;
|
||||||
int arglen = sizeof(struct in_addr);
|
socklen_t arglen = sizeof(struct in_addr);
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
n = getsockopt(fdval(env, fdo), IPPROTO_IP, IP_MULTICAST_IF, (void*)&in, &arglen);
|
n = getsockopt(fdval(env, fdo), IPPROTO_IP, IP_MULTICAST_IF, (void*)&in, &arglen);
|
||||||
@ -556,7 +557,7 @@ JNIEXPORT jint JNICALL
|
|||||||
Java_sun_nio_ch_Net_getInterface6(JNIEnv* env, jobject this, jobject fdo)
|
Java_sun_nio_ch_Net_getInterface6(JNIEnv* env, jobject this, jobject fdo)
|
||||||
{
|
{
|
||||||
int index;
|
int index;
|
||||||
int arglen = sizeof(index);
|
socklen_t arglen = sizeof(index);
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
n = getsockopt(fdval(env, fdo), IPPROTO_IPV6, IPV6_MULTICAST_IF, (void*)&index, &arglen);
|
n = getsockopt(fdval(env, fdo), IPPROTO_IPV6, IPV6_MULTICAST_IF, (void*)&index, &arglen);
|
||||||
|
@ -537,7 +537,7 @@ JNIEXPORT int JNICALL Java_sun_nio_ch_SctpNet_getIntOption0
|
|||||||
int result;
|
int result;
|
||||||
struct linger linger;
|
struct linger linger;
|
||||||
void *arg;
|
void *arg;
|
||||||
unsigned int arglen;
|
int arglen;
|
||||||
|
|
||||||
if (mapSocketOption(opt, &klevel, &kopt) < 0) {
|
if (mapSocketOption(opt, &klevel, &kopt) < 0) {
|
||||||
JNU_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
|
JNU_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
|
||||||
|
@ -40,10 +40,10 @@ Java_sun_nio_ch_UnixAsynchronousSocketChannelImpl_checkConnect(JNIEnv *env,
|
|||||||
jobject this, int fd)
|
jobject this, int fd)
|
||||||
{
|
{
|
||||||
int error = 0;
|
int error = 0;
|
||||||
int n = sizeof(error);
|
socklen_t arglen = sizeof(error);
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
result = getsockopt(fd, SOL_SOCKET, SO_ERROR, &error, &n);
|
result = getsockopt(fd, SOL_SOCKET, SO_ERROR, &error, &arglen);
|
||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
JNU_ThrowIOExceptionWithLastError(env, "getsockopt");
|
JNU_ThrowIOExceptionWithLastError(env, "getsockopt");
|
||||||
} else {
|
} else {
|
||||||
|
@ -79,7 +79,7 @@ BOOL useNativeConverter(JNIEnv *env) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
jstring nativeNewStringPlatform(JNIEnv *env, const char *str) {
|
jstring nativeNewStringPlatform(JNIEnv *env, const char *str) {
|
||||||
static String_char_constructor = NULL;
|
static jmethodID String_char_constructor;
|
||||||
if (useNativeConverter(env)) {
|
if (useNativeConverter(env)) {
|
||||||
// use native Unicode conversion so Kernel isn't required during
|
// use native Unicode conversion so Kernel isn't required during
|
||||||
// System.initProperties
|
// System.initProperties
|
||||||
|
@ -489,7 +489,7 @@ GetJavaProperties(JNIEnv* env)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
sprintf(buf, "%d.%d", ver.dwMajorVersion, ver.dwMinorVersion);
|
sprintf(buf, "%d.%d", ver.dwMajorVersion, ver.dwMinorVersion);
|
||||||
sprops.os_version = strdup(buf);
|
sprops.os_version = _strdup(buf);
|
||||||
#if _M_IA64
|
#if _M_IA64
|
||||||
sprops.os_arch = "ia64";
|
sprops.os_arch = "ia64";
|
||||||
#elif _M_AMD64
|
#elif _M_AMD64
|
||||||
@ -500,7 +500,7 @@ GetJavaProperties(JNIEnv* env)
|
|||||||
sprops.os_arch = "unknown";
|
sprops.os_arch = "unknown";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
sprops.patch_level = strdup(ver.szCSDVersion);
|
sprops.patch_level = _strdup(ver.szCSDVersion);
|
||||||
|
|
||||||
sprops.desktop = "windows";
|
sprops.desktop = "windows";
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include "jvm.h"
|
||||||
#include "TimeZone_md.h"
|
#include "TimeZone_md.h"
|
||||||
|
|
||||||
#define VALUE_UNKNOWN 0
|
#define VALUE_UNKNOWN 0
|
||||||
@ -463,7 +464,7 @@ static char *matchJavaTZ(const char *java_home_dir, int value_type, char *tzName
|
|||||||
/*
|
/*
|
||||||
* Found the time zone in the mapping table.
|
* Found the time zone in the mapping table.
|
||||||
*/
|
*/
|
||||||
javaTZName = strdup(items[TZ_JAVA_NAME]);
|
javaTZName = _strdup(items[TZ_JAVA_NAME]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
@ -473,7 +474,7 @@ static char *matchJavaTZ(const char *java_home_dir, int value_type, char *tzName
|
|||||||
strncpy(bestMatch, items[TZ_JAVA_NAME], MAX_ZONE_CHAR);
|
strncpy(bestMatch, items[TZ_JAVA_NAME], MAX_ZONE_CHAR);
|
||||||
} else if (country != NULL && strcmp(items[TZ_REGION], country) == 0) {
|
} else if (country != NULL && strcmp(items[TZ_REGION], country) == 0) {
|
||||||
if (value_type == VALUE_MAPID) {
|
if (value_type == VALUE_MAPID) {
|
||||||
javaTZName = strdup(items[TZ_JAVA_NAME]);
|
javaTZName = _strdup(items[TZ_JAVA_NAME]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
strncpy(bestMatch, items[TZ_JAVA_NAME], MAX_ZONE_CHAR);
|
strncpy(bestMatch, items[TZ_JAVA_NAME], MAX_ZONE_CHAR);
|
||||||
@ -490,7 +491,7 @@ static char *matchJavaTZ(const char *java_home_dir, int value_type, char *tzName
|
|||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
|
||||||
if (javaTZName == NULL && bestMatch[0] != '\0') {
|
if (javaTZName == NULL && bestMatch[0] != '\0') {
|
||||||
javaTZName = strdup(bestMatch);
|
javaTZName = _strdup(bestMatch);
|
||||||
}
|
}
|
||||||
return javaTZName;
|
return javaTZName;
|
||||||
|
|
||||||
@ -515,7 +516,7 @@ char *findJavaTZ_md(const char *java_home_dir, const char *country)
|
|||||||
|
|
||||||
if (result != VALUE_UNKNOWN) {
|
if (result != VALUE_UNKNOWN) {
|
||||||
if (result == VALUE_GMTOFFSET) {
|
if (result == VALUE_GMTOFFSET) {
|
||||||
std_timezone = strdup(winZoneName);
|
std_timezone = _strdup(winZoneName);
|
||||||
} else {
|
} else {
|
||||||
std_timezone = matchJavaTZ(java_home_dir, result,
|
std_timezone = matchJavaTZ(java_home_dir, result,
|
||||||
winZoneName, winMapID, country);
|
winZoneName, winMapID, country);
|
||||||
|
@ -84,7 +84,6 @@ Java_sun_nio_ch_ServerSocketChannelImpl_accept0(JNIEnv *env, jobject this,
|
|||||||
jobject remote_ia;
|
jobject remote_ia;
|
||||||
int remote_port;
|
int remote_port;
|
||||||
jobject isa;
|
jobject isa;
|
||||||
jobject ia;
|
|
||||||
int addrlen = sizeof(sa);
|
int addrlen = sizeof(sa);
|
||||||
|
|
||||||
memset((char *)&sa, 0, sizeof(sa));
|
memset((char *)&sa, 0, sizeof(sa));
|
||||||
|
@ -223,7 +223,7 @@ Java_sun_nio_ch_WindowsSelectorImpl_discardUrgentData(JNIEnv* env, jobject this,
|
|||||||
jboolean discarded = JNI_FALSE;
|
jboolean discarded = JNI_FALSE;
|
||||||
int n;
|
int n;
|
||||||
do {
|
do {
|
||||||
n = recv(s, &data, sizeof(data), MSG_OOB);
|
n = recv(s, (char*)&data, sizeof(data), MSG_OOB);
|
||||||
if (n > 0) {
|
if (n > 0) {
|
||||||
discarded = JNI_TRUE;
|
discarded = JNI_TRUE;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user