Skip to content
This repository was archived by the owner on Sep 2, 2022. It is now read-only.

Commit 2826d30

Browse files
committed
8264047: Duplicate global variable 'jvm' in libjavajpeg and libawt
Backport-of: eb6330e4f0366878e7ec8a606ddc717622cbdaea
1 parent 4f5421e commit 2826d30

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

src/java.desktop/share/native/libjavajpeg/imageioJPEG.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ static jfieldID JPEGHuffmanTable_valuesID;
8585
/*
8686
* Defined in jpegdecoder.c. Copy code from there if and
8787
* when that disappears. */
88-
extern JavaVM *jvm;
88+
extern JavaVM *the_jvm;
8989

9090
/*
9191
* The following sets of defines must match the warning messages in the
@@ -557,7 +557,7 @@ sun_jpeg_output_message (j_common_ptr cinfo)
557557
char buffer[JMSG_LENGTH_MAX];
558558
jstring string;
559559
imageIODataPtr data = (imageIODataPtr) cinfo->client_data;
560-
JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
560+
JNIEnv *env = (JNIEnv *)JNU_GetEnv(the_jvm, JNI_VERSION_1_2);
561561
jobject theObject;
562562

563563
/* Create the message */
@@ -928,7 +928,7 @@ imageio_fill_input_buffer(j_decompress_ptr cinfo)
928928
struct jpeg_source_mgr *src = cinfo->src;
929929
imageIODataPtr data = (imageIODataPtr) cinfo->client_data;
930930
streamBufferPtr sb = &data->streamBuf;
931-
JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
931+
JNIEnv *env = (JNIEnv *)JNU_GetEnv(the_jvm, JNI_VERSION_1_2);
932932
int ret;
933933
jobject input = NULL;
934934

@@ -1021,7 +1021,7 @@ imageio_fill_suspended_buffer(j_decompress_ptr cinfo)
10211021
struct jpeg_source_mgr *src = cinfo->src;
10221022
imageIODataPtr data = (imageIODataPtr) cinfo->client_data;
10231023
streamBufferPtr sb = &data->streamBuf;
1024-
JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
1024+
JNIEnv *env = (JNIEnv *)JNU_GetEnv(the_jvm, JNI_VERSION_1_2);
10251025
jint ret;
10261026
size_t offset, buflen;
10271027
jobject input = NULL;
@@ -1122,7 +1122,7 @@ imageio_skip_input_data(j_decompress_ptr cinfo, long num_bytes)
11221122
struct jpeg_source_mgr *src = cinfo->src;
11231123
imageIODataPtr data = (imageIODataPtr) cinfo->client_data;
11241124
streamBufferPtr sb = &data->streamBuf;
1125-
JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
1125+
JNIEnv *env = (JNIEnv *)JNU_GetEnv(the_jvm, JNI_VERSION_1_2);
11261126
jlong ret;
11271127
jobject reader;
11281128
jobject input = NULL;
@@ -1207,7 +1207,7 @@ imageio_term_source(j_decompress_ptr cinfo)
12071207
// To pushback, just seek back by src->bytes_in_buffer
12081208
struct jpeg_source_mgr *src = cinfo->src;
12091209
imageIODataPtr data = (imageIODataPtr) cinfo->client_data;
1210-
JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
1210+
JNIEnv *env = (JNIEnv *)JNU_GetEnv(the_jvm, JNI_VERSION_1_2);
12111211
jobject reader = data->imageIOobj;
12121212
if (src->bytes_in_buffer > 0) {
12131213
RELEASE_ARRAYS(env, data, src->next_input_byte);
@@ -2369,7 +2369,7 @@ imageio_init_destination (j_compress_ptr cinfo)
23692369
struct jpeg_destination_mgr *dest = cinfo->dest;
23702370
imageIODataPtr data = (imageIODataPtr) cinfo->client_data;
23712371
streamBufferPtr sb = &data->streamBuf;
2372-
JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
2372+
JNIEnv *env = (JNIEnv *)JNU_GetEnv(the_jvm, JNI_VERSION_1_2);
23732373

23742374
if (sb->buf == NULL) {
23752375
// We forgot to pin the array
@@ -2395,7 +2395,7 @@ imageio_empty_output_buffer (j_compress_ptr cinfo)
23952395
struct jpeg_destination_mgr *dest = cinfo->dest;
23962396
imageIODataPtr data = (imageIODataPtr) cinfo->client_data;
23972397
streamBufferPtr sb = &data->streamBuf;
2398-
JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
2398+
JNIEnv *env = (JNIEnv *)JNU_GetEnv(the_jvm, JNI_VERSION_1_2);
23992399
jobject output = NULL;
24002400

24012401
RELEASE_ARRAYS(env, data, (const JOCTET *)(dest->next_output_byte));
@@ -2431,7 +2431,7 @@ imageio_term_destination (j_compress_ptr cinfo)
24312431
struct jpeg_destination_mgr *dest = cinfo->dest;
24322432
imageIODataPtr data = (imageIODataPtr) cinfo->client_data;
24332433
streamBufferPtr sb = &data->streamBuf;
2434-
JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
2434+
JNIEnv *env = (JNIEnv *)JNU_GetEnv(the_jvm, JNI_VERSION_1_2);
24352435

24362436
/* find out how much needs to be written */
24372437
/* this conversion from size_t to jint is safe, because the lenght of the buffer is limited by jint */

src/java.desktop/share/native/libjavajpeg/jpegdecoder.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,12 @@ static jmethodID InputStream_availableID;
6464

6565
/* Initialize the Java VM instance variable when the library is
6666
first loaded */
67-
JavaVM *jvm;
67+
JavaVM *the_jvm;
6868

6969
JNIEXPORT jint JNICALL
7070
DEF_JNI_OnLoad(JavaVM *vm, void *reserved)
7171
{
72-
jvm = vm;
72+
the_jvm = vm;
7373
return JNI_VERSION_1_2;
7474
}
7575

@@ -284,7 +284,7 @@ GLOBAL(boolean)
284284
sun_jpeg_fill_input_buffer(j_decompress_ptr cinfo)
285285
{
286286
sun_jpeg_source_ptr src = (sun_jpeg_source_ptr) cinfo->src;
287-
JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
287+
JNIEnv *env = (JNIEnv *)JNU_GetEnv(the_jvm, JNI_VERSION_1_2);
288288
int ret, buflen;
289289

290290
if (src->suspendable) {
@@ -327,7 +327,7 @@ GLOBAL(void)
327327
sun_jpeg_fill_suspended_buffer(j_decompress_ptr cinfo)
328328
{
329329
sun_jpeg_source_ptr src = (sun_jpeg_source_ptr) cinfo->src;
330-
JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
330+
JNIEnv *env = (JNIEnv *)JNU_GetEnv(the_jvm, JNI_VERSION_1_2);
331331
size_t offset, buflen;
332332
int ret;
333333

@@ -397,7 +397,7 @@ GLOBAL(void)
397397
sun_jpeg_skip_input_data(j_decompress_ptr cinfo, long num_bytes)
398398
{
399399
sun_jpeg_source_ptr src = (sun_jpeg_source_ptr) cinfo->src;
400-
JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
400+
JNIEnv *env = (JNIEnv *)JNU_GetEnv(the_jvm, JNI_VERSION_1_2);
401401
int ret;
402402
int buflen;
403403

0 commit comments

Comments
 (0)