RFR 8198970: jnu_util.c compilation error on Solaris
Kim Barrett
kim.barrett at oracle.com
Mon Mar 5 06:34:01 UTC 2018
> On Mar 2, 2018, at 10:36 PM, David Holmes <david.holmes at oracle.com> wrote:
>
> On 3/03/2018 8:56 AM, Roger Riggs wrote:
>> Please review a correction to the jni_util.c native code that does not compile on Solaris.
>> Declarations must precede assignments.
>
> Wow! I didn't think Solaris Studio compiler was subject to such anachronisms! We must be compiling in a really old mode. I'm pretty darn certain we're not limited this way when compiling hotspot ..
This is C, not C++, and is apparently being compiled in C89 mode. (Mixing declarations and statements in compound statements was added in C99.)
> David
>
>> Issue: 8198970 jnu_util.c compilation error on Solaris <https://bugs.openjdk.java.net/browse/JDK-8198970>
>> diff --git a/src/java.base/share/native/libjava/jni_util.c b/src/java.base/share/native/libjava/jni_util.c
>> --- a/src/java.base/share/native/libjava/jni_util.c
>> +++ b/src/java.base/share/native/libjava/jni_util.c
>> @@ -803,10 +803,10 @@ InitializeEncoding(JNIEnv *env, const ch
>> (strcmp(encname, "ISO-8859-1") == 0)) {
>> fastEncoding = FAST_8859_1;
>> } else if (strcmp(encname, "UTF-8") == 0) {
>> - fastEncoding = FAST_UTF_8;
>> jstring enc = (*env)->NewStringUTF(env, encname);
>> if (enc == NULL)
>> return;
>> + fastEncoding = FAST_UTF_8;
>> jnuEncoding = (jstring)(*env)->NewGlobalRef(env, enc);
>> (*env)->DeleteLocalRef(env, enc);
>> } else if (strcmp(encname, "ISO646-US") == 0) {
>> @@ -818,10 +818,10 @@ InitializeEncoding(JNIEnv *env, const ch
>> strcmp(encname, "utf-16le") == 0) {
>> fastEncoding = FAST_CP1252;
>> } else {
>> - fastEncoding = NO_FAST_ENCODING;
>> jstring enc = (*env)->NewStringUTF(env, encname);
>> if (enc == NULL)
>> return;
>> + fastEncoding = NO_FAST_ENCODING;
>> jnuEncoding = (jstring)(*env)->NewGlobalRef(env, enc);
>> (*env)->DeleteLocalRef(env, enc);
>> }
>> Thanks, Roger
More information about the core-libs-dev
mailing list