@@ -213,7 +213,7 @@ std::string fetch_string(JNIEnv *env, jobject o, jfieldID id) {
213
213
214
214
std::string from_jstring (JNIEnv *env, jstring s) {
215
215
if (!s) {
216
- return " " ;
216
+ return std::string () ;
217
217
}
218
218
jsize s_len = env->GetStringLength (s);
219
219
const jchar *p = env->GetStringChars (s, nullptr );
@@ -264,7 +264,7 @@ std::string from_bytes(JNIEnv *env, jbyteArray arr) {
264
264
265
265
jbyteArray to_bytes (JNIEnv *env, const std::string &b) {
266
266
static_assert (sizeof (char ) == sizeof (jbyte), " Mismatched jbyte size" );
267
- jsize length = narrow_cast<jsize>(b.size ());
267
+ auto length = narrow_cast<jsize>(b.size ());
268
268
jbyteArray arr = env->NewByteArray (length);
269
269
if (arr != nullptr && length != 0 ) {
270
270
env->SetByteArrayRegion (arr, 0 , length, reinterpret_cast <const jbyte *>(b.data ()));
@@ -274,7 +274,7 @@ jbyteArray to_bytes(JNIEnv *env, const std::string &b) {
274
274
275
275
jintArray store_vector (JNIEnv *env, const std::vector<std::int32_t > &v) {
276
276
static_assert (sizeof (std::int32_t ) == sizeof (jint), " Mismatched jint size" );
277
- jsize length = narrow_cast<jsize>(v.size ());
277
+ auto length = narrow_cast<jsize>(v.size ());
278
278
jintArray arr = env->NewIntArray (length);
279
279
if (arr != nullptr && length != 0 ) {
280
280
env->SetIntArrayRegion (arr, 0 , length, reinterpret_cast <const jint *>(&v[0 ]));
@@ -284,7 +284,7 @@ jintArray store_vector(JNIEnv *env, const std::vector<std::int32_t> &v) {
284
284
285
285
jlongArray store_vector (JNIEnv *env, const std::vector<std::int64_t > &v) {
286
286
static_assert (sizeof (std::int64_t ) == sizeof (jlong), " Mismatched jlong size" );
287
- jsize length = narrow_cast<jsize>(v.size ());
287
+ auto length = narrow_cast<jsize>(v.size ());
288
288
jlongArray arr = env->NewLongArray (length);
289
289
if (arr != nullptr && length != 0 ) {
290
290
env->SetLongArrayRegion (arr, 0 , length, reinterpret_cast <const jlong *>(&v[0 ]));
@@ -294,7 +294,7 @@ jlongArray store_vector(JNIEnv *env, const std::vector<std::int64_t> &v) {
294
294
295
295
jdoubleArray store_vector (JNIEnv *env, const std::vector<double > &v) {
296
296
static_assert (sizeof (double ) == sizeof (jdouble), " Mismatched jdouble size" );
297
- jsize length = narrow_cast<jsize>(v.size ());
297
+ auto length = narrow_cast<jsize>(v.size ());
298
298
jdoubleArray arr = env->NewDoubleArray (length);
299
299
if (arr != nullptr && length != 0 ) {
300
300
env->SetDoubleArrayRegion (arr, 0 , length, reinterpret_cast <const jdouble *>(&v[0 ]));
@@ -303,7 +303,7 @@ jdoubleArray store_vector(JNIEnv *env, const std::vector<double> &v) {
303
303
}
304
304
305
305
jobjectArray store_vector (JNIEnv *env, const std::vector<std::string> &v) {
306
- jsize length = narrow_cast<jsize>(v.size ());
306
+ auto length = narrow_cast<jsize>(v.size ());
307
307
jobjectArray arr = env->NewObjectArray (length, StringClass, 0 );
308
308
if (arr != nullptr ) {
309
309
for (jsize i = 0 ; i < length; i++) {
0 commit comments