@@ -25,7 +25,7 @@ Local<Value> ArrayElementAccessor::GetArrayElement(const Local<Object>& array, u
2525 Isolate* isolate = Isolate::GetCurrent ();
2626 EscapableHandleScope handleScope (isolate);
2727
28- jweak arr = objectManager->GetJavaObjectByJsObject (array);
28+ auto arr = objectManager->GetJavaObjectByJsObject (array);
2929
3030 Local<Value> value;
3131 jsize startIndex = index;
@@ -36,21 +36,21 @@ Local<Value> ArrayElementAccessor::GetArrayElement(const Local<Object>& array, u
3636
3737 if (elementSignature == " Z" )
3838 {
39- jbooleanArray boolArr = reinterpret_cast <jbooleanArray>(arr);
39+ jbooleanArray boolArr = static_cast <jbooleanArray>(arr);
4040 jboolean boolArrValue;
4141 env.GetBooleanArrayRegion (boolArr, startIndex, length, &boolArrValue);
4242 value = ConvertToJsValue (env, elementSignature, &boolArrValue);
4343 }
4444 else if (elementSignature == " B" )
4545 {
46- jbyteArray byteArr = reinterpret_cast <jbyteArray>(arr);
46+ jbyteArray byteArr = static_cast <jbyteArray>(arr);
4747 jbyte byteArrValue;
4848 env.GetByteArrayRegion (byteArr, startIndex, length, &byteArrValue);
4949 value = ConvertToJsValue (env, elementSignature, &byteArrValue);
5050 }
5151 else if (elementSignature == " C" )
5252 {
53- jcharArray charArr = reinterpret_cast <jcharArray>(arr);
53+ jcharArray charArr = static_cast <jcharArray>(arr);
5454 jchar charArrValue;
5555 env.GetCharArrayRegion (charArr, startIndex, length, &charArrValue);
5656 JniLocalRef s (env.NewString (&charArrValue, 1 ));
@@ -60,42 +60,42 @@ Local<Value> ArrayElementAccessor::GetArrayElement(const Local<Object>& array, u
6060 }
6161 else if (elementSignature == " S" )
6262 {
63- jshortArray shortArr = reinterpret_cast <jshortArray>(arr);
63+ jshortArray shortArr = static_cast <jshortArray>(arr);
6464 jshort shortArrValue;
6565 env.GetShortArrayRegion (shortArr, startIndex, length, &shortArrValue);
6666 value = ConvertToJsValue (env, elementSignature, &shortArrValue);
6767 }
6868 else if (elementSignature == " I" )
6969 {
70- jintArray intArr = reinterpret_cast <jintArray>(arr);
70+ jintArray intArr = static_cast <jintArray>(arr);
7171 jint intArrValue;
7272 env.GetIntArrayRegion (intArr, startIndex, length, &intArrValue);
7373 value = ConvertToJsValue (env, elementSignature, &intArrValue);
7474 }
7575 else if (elementSignature == " J" )
7676 {
77- jlongArray longArr = reinterpret_cast <jlongArray>(arr);
77+ jlongArray longArr = static_cast <jlongArray>(arr);
7878 jlong longArrValue;
7979 env.GetLongArrayRegion (longArr, startIndex, length, &longArrValue);
8080 value = ConvertToJsValue (env, elementSignature, &longArrValue);
8181 }
8282 else if (elementSignature == " F" )
8383 {
84- jfloatArray floatArr = reinterpret_cast <jfloatArray>(arr);
84+ jfloatArray floatArr = static_cast <jfloatArray>(arr);
8585 jfloat floatArrValue;
8686 env.GetFloatArrayRegion (floatArr, startIndex, length, &floatArrValue);
8787 value = ConvertToJsValue (env, elementSignature, &floatArrValue);
8888 }
8989 else if (elementSignature == " D" )
9090 {
91- jdoubleArray doubleArr = reinterpret_cast <jdoubleArray>(arr);
91+ jdoubleArray doubleArr = static_cast <jdoubleArray>(arr);
9292 jdouble doubleArrValue;
9393 env.GetDoubleArrayRegion (doubleArr, startIndex, length, &doubleArrValue);
9494 value = ConvertToJsValue (env, elementSignature, &doubleArrValue);
9595 }
9696 else
9797 {
98- jobject result = env.GetObjectArrayElement (reinterpret_cast <jobjectArray>(arr), index);
98+ jobject result = env.GetObjectArrayElement (static_cast <jobjectArray>(arr), index);
9999 value = ConvertToJsValue (env, elementSignature, &result);
100100 env.DeleteLocalRef (result);
101101 }
@@ -110,21 +110,21 @@ void ArrayElementAccessor::SetArrayElement(const Local<Object>& array, uint32_t
110110 Isolate* isolate = Isolate::GetCurrent ();
111111 HandleScope handleScope (isolate);
112112
113- jweak arr = objectManager->GetJavaObjectByJsObject (array);
113+ auto arr = objectManager->GetJavaObjectByJsObject (array);
114114
115115 const string elementSignature = arraySignature.substr (1 );
116116 jboolean isCopy = false ;
117117
118118 if (elementSignature == " Z" ) // bool
119119 {
120120 jboolean boolElementValue = (jboolean) value->BooleanValue ();
121- jbooleanArray boolArr = reinterpret_cast <jbooleanArray>(arr);
121+ jbooleanArray boolArr = static_cast <jbooleanArray>(arr);
122122 env.SetBooleanArrayRegion (boolArr, index, 1 , &boolElementValue);
123123 }
124124 else if (elementSignature == " B" ) // byte
125125 {
126126 jbyte byteElementValue = (jbyte) value->Int32Value ();
127- jbyteArray byteArr = reinterpret_cast <jbyteArray>(arr);
127+ jbyteArray byteArr = static_cast <jbyteArray>(arr);
128128 env.SetByteArrayRegion (byteArr, index, 1 , &byteElementValue);
129129 }
130130 else if (elementSignature == " C" ) // char
@@ -134,19 +134,19 @@ void ArrayElementAccessor::SetArrayElement(const Local<Object>& array, uint32_t
134134 const char * singleChar = env.GetStringUTFChars (s, &isCopy);
135135 jchar charElementValue = *singleChar;
136136 env.ReleaseStringUTFChars (s, singleChar);
137- jcharArray charArr = reinterpret_cast <jcharArray>(arr);
137+ jcharArray charArr = static_cast <jcharArray>(arr);
138138 env.SetCharArrayRegion (charArr, index, 1 , &charElementValue);
139139 }
140140 else if (elementSignature == " S" ) // short
141141 {
142142 jshort shortElementValue = (jshort) value->Int32Value ();
143- jshortArray shortArr = reinterpret_cast <jshortArray>(arr);
143+ jshortArray shortArr = static_cast <jshortArray>(arr);
144144 env.SetShortArrayRegion (shortArr, index, 1 , &shortElementValue);
145145 }
146146 else if (elementSignature == " I" ) // int
147147 {
148148 jint intElementValue = value->Int32Value ();
149- jintArray intArr = reinterpret_cast <jintArray>(arr);
149+ jintArray intArr = static_cast <jintArray>(arr);
150150 env.SetIntArrayRegion (intArr, index, 1 , &intElementValue);
151151 }
152152 else if (elementSignature == " J" ) // long
@@ -160,19 +160,19 @@ void ArrayElementAccessor::SetArrayElement(const Local<Object>& array, uint32_t
160160 {
161161 longElementValue = (jlong) value->IntegerValue ();
162162 }
163- jlongArray longArr = reinterpret_cast <jlongArray>(arr);
163+ jlongArray longArr = static_cast <jlongArray>(arr);
164164 env.SetLongArrayRegion (longArr, index, 1 , &longElementValue);
165165 }
166166 else if (elementSignature == " F" ) // float
167167 {
168168 jfloat floatElementValue = (jfloat) value->NumberValue ();
169- jfloatArray floatArr = reinterpret_cast <jfloatArray>(arr);
169+ jfloatArray floatArr = static_cast <jfloatArray>(arr);
170170 env.SetFloatArrayRegion (floatArr, index, 1 , &floatElementValue);
171171 }
172172 else if (elementSignature == " D" ) // double
173173 {
174174 jdouble doubleElementValue = (jdouble) value->NumberValue ();
175- jdoubleArray doubleArr = reinterpret_cast <jdoubleArray>(arr);
175+ jdoubleArray doubleArr = static_cast <jdoubleArray>(arr);
176176 env.SetDoubleArrayRegion (doubleArr, index, 1 , &doubleElementValue);
177177 }
178178 else // string or object
@@ -185,7 +185,7 @@ void ArrayElementAccessor::SetArrayElement(const Local<Object>& array, uint32_t
185185 JsArgToArrayConverter argConverter (value, false , (int ) Type::Null);
186186 if (argConverter.IsValid ())
187187 {
188- jobjectArray objArr = reinterpret_cast <jobjectArray>(arr);
188+ jobjectArray objArr = static_cast <jobjectArray>(arr);
189189 jobject objectElementValue = argConverter.GetConvertedArg ();
190190 env.SetObjectArrayElement (objArr, index, objectElementValue);
191191 }
0 commit comments