@@ -184,18 +184,10 @@ std::string ArgConverter::jstringToString(jstring value)
184184 return string ();
185185 }
186186
187- jsize utfLength;
188- bool readInBuffer = ReadJStringInBuffer (value, utfLength);
189- if (readInBuffer)
190- {
191- string s (charBuffer, utfLength);
192- return s;
193- }
194-
195187 JEnv env;
196188
197- jboolean f = false ;
198- const char * chars = env.GetStringUTFChars (value, &f);
189+ jboolean f = JNI_FALSE ;
190+ auto chars = env.GetStringUTFChars (value, &f);
199191 string s (chars);
200192 env.ReleaseStringUTFChars (value, chars);
201193
@@ -218,27 +210,6 @@ Local<Value> ArgConverter::jstringToV8String(Isolate *isolate, jstring value)
218210 return v8String;
219211}
220212
221- bool ArgConverter::ReadJStringInBuffer (jstring value, jsize& utfLength)
222- {
223- if (value == nullptr )
224- {
225- return false ;
226- }
227-
228- JEnv env;
229- utfLength = env.GetStringUTFLength (value);
230- if (utfLength > BUFFER_SIZE)
231- {
232- return false ;
233- }
234-
235- jsize strLength = env.GetStringLength (value);
236- // use existing buffer to prevent extensive memory allocation
237- env.GetStringUTFRegion (value, (jsize) 0 , strLength, charBuffer);
238-
239- return true ;
240- }
241-
242213Local<String> ArgConverter::jcharToV8String (Isolate *isolate, jchar value)
243214{
244215 auto v8String = ConvertToV8String (isolate, &value, 1 );
@@ -340,5 +311,4 @@ Local<String> ArgConverter::ConvertToV8String(Isolate *isolate, const char *data
340311}
341312
342313
343- std::map<Isolate*, ArgConverter::TypeLongOperationsCache *> ArgConverter::s_type_long_operations_cache;
344- char * ArgConverter::charBuffer = new char [ArgConverter::BUFFER_SIZE];
314+ std::map<Isolate*, ArgConverter::TypeLongOperationsCache *> ArgConverter::s_type_long_operations_cache;
0 commit comments