Skip to content

Commit 6c2fdc7

Browse files
committed
Prefer bool to jboolean where it's not used as a native value
1 parent e890186 commit 6c2fdc7

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

include/jni/functions.hpp

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,16 @@ namespace jni
4949
Wrap<jfieldID*>(env.FromReflectedField(Unwrap(obj))));
5050
}
5151

52-
inline jobject& ToReflectedMethod(JNIEnv& env, jclass& clazz, jmethodID& method, jboolean isStatic)
52+
inline jobject& ToReflectedMethod(JNIEnv& env, jclass& clazz, jmethodID& method, bool isStatic)
5353
{
5454
return *CheckJavaException(env,
55-
Wrap<jobject*>(env.ToReflectedMethod(Unwrap(clazz), Unwrap(method), Unwrap(isStatic))));
55+
Wrap<jobject*>(env.ToReflectedMethod(Unwrap(clazz), Unwrap(method), isStatic)));
5656
}
5757

58-
inline jobject& ToReflectedField(JNIEnv& env, jclass& clazz, jfieldID& field, jboolean isStatic)
58+
inline jobject& ToReflectedField(JNIEnv& env, jclass& clazz, jfieldID& field, bool isStatic)
5959
{
6060
return *CheckJavaException(env,
61-
Wrap<jobject*>(env.ToReflectedField(Unwrap(clazz), Unwrap(field), Unwrap(isStatic))));
61+
Wrap<jobject*>(env.ToReflectedField(Unwrap(clazz), Unwrap(field), isStatic)));
6262
}
6363

6464

@@ -68,10 +68,10 @@ namespace jni
6868
Wrap<jclass*>(env.GetSuperclass(Unwrap(clazz))));
6969
}
7070

71-
inline jboolean IsAssignableFrom(JNIEnv& env, jclass& clazz1, jclass& clazz2)
71+
inline bool IsAssignableFrom(JNIEnv& env, jclass& clazz1, jclass& clazz2)
7272
{
7373
return CheckJavaException(env,
74-
Wrap<jboolean>(env.IsAssignableFrom(Unwrap(clazz1), Unwrap(clazz2))));
74+
env.IsAssignableFrom(Unwrap(clazz1), Unwrap(clazz2)));
7575
}
7676

7777

@@ -87,7 +87,7 @@ namespace jni
8787
throw PendingJavaException();
8888
}
8989

90-
inline jboolean ExceptionCheck(JNIEnv& env)
90+
inline bool ExceptionCheck(JNIEnv& env)
9191
{
9292
return env.ExceptionCheck();
9393
}
@@ -175,10 +175,10 @@ namespace jni
175175
}
176176

177177

178-
inline jboolean IsSameObject(JNIEnv& env, jobject* ref1, jobject* ref2)
178+
inline bool IsSameObject(JNIEnv& env, jobject* ref1, jobject* ref2)
179179
{
180180
return CheckJavaException(env,
181-
Wrap<jboolean>(env.IsSameObject(Unwrap(ref1), Unwrap(ref2))));
181+
env.IsSameObject(Unwrap(ref1), Unwrap(ref2)));
182182
}
183183

184184
inline jobject& AllocObject(JNIEnv& env, jclass& clazz)
@@ -200,10 +200,10 @@ namespace jni
200200
Wrap<jclass*>(env.GetObjectClass(Unwrap(obj))));
201201
}
202202

203-
inline jboolean IsInstanceOf(JNIEnv& env, jobject* obj, jclass& clazz)
203+
inline bool IsInstanceOf(JNIEnv& env, jobject* obj, jclass& clazz)
204204
{
205205
return CheckJavaException(env,
206-
Wrap<jboolean>(env.IsInstanceOf(Unwrap(obj), Unwrap(clazz))));
206+
env.IsInstanceOf(Unwrap(obj), Unwrap(clazz))) == JNI_TRUE;
207207
}
208208

209209

@@ -330,12 +330,12 @@ namespace jni
330330
Wrap<jsize>(env.GetStringLength(Unwrap(string))));
331331
}
332332

333-
inline std::tuple<UniqueStringChars, jboolean> GetStringChars(JNIEnv& env, jstring& string)
333+
inline std::tuple<UniqueStringChars, bool> GetStringChars(JNIEnv& env, jstring& string)
334334
{
335335
::jboolean isCopy = JNI_FALSE;
336336
const char16_t* result = CheckJavaException(env,
337337
Wrap<const char16_t*>(env.GetStringChars(Unwrap(string), &isCopy)));
338-
return std::make_tuple(UniqueStringChars(result, StringCharsDeleter(env, string)), Wrap<jboolean>(isCopy));
338+
return std::make_tuple(UniqueStringChars(result, StringCharsDeleter(env, string)), isCopy);
339339
}
340340

341341
inline void ReleaseStringChars(JNIEnv& env, jstring& string, UniqueStringChars&& chars)
@@ -356,12 +356,12 @@ namespace jni
356356
Wrap<jsize>(env.GetStringUTFLength(Unwrap(string))));
357357
}
358358

359-
inline std::tuple<UniqueStringUTFChars, jboolean> GetStringUTFChars(JNIEnv& env, jstring& string)
359+
inline std::tuple<UniqueStringUTFChars, bool> GetStringUTFChars(JNIEnv& env, jstring& string)
360360
{
361361
::jboolean isCopy = JNI_FALSE;
362362
const char* result = CheckJavaException(env,
363363
env.GetStringUTFChars(Unwrap(string), &isCopy));
364-
return std::make_tuple(UniqueStringUTFChars(result, StringUTFCharsDeleter(env, string)), Wrap<jboolean>(isCopy));
364+
return std::make_tuple(UniqueStringUTFChars(result, StringUTFCharsDeleter(env, string)), isCopy);
365365
}
366366

367367
inline void ReleaseStringUTFChars(JNIEnv& env, jstring& string, UniqueStringUTFChars&& chars)
@@ -396,12 +396,12 @@ namespace jni
396396
GetStringUTFRegion(env, string, start, ArraylikeSize(buf), ArraylikeData(buf));
397397
}
398398

399-
inline std::tuple<UniqueStringCritical, jboolean> GetStringCritical(JNIEnv& env, jstring& string)
399+
inline std::tuple<UniqueStringCritical, bool> GetStringCritical(JNIEnv& env, jstring& string)
400400
{
401401
::jboolean isCopy = JNI_FALSE;
402402
const char16_t* result = CheckJavaException(env,
403403
Wrap<const char16_t*>(env.GetStringCritical(Unwrap(string), &isCopy)));
404-
return std::make_tuple(UniqueStringCritical(result, StringCriticalDeleter(env, string)), Wrap<jboolean>(isCopy));
404+
return std::make_tuple(UniqueStringCritical(result, StringCriticalDeleter(env, string)), isCopy);
405405
}
406406

407407
inline void ReleaseStringCritical(JNIEnv& env, jstring& string, UniqueStringCritical&& chars)
@@ -426,12 +426,12 @@ namespace jni
426426
}
427427

428428
template < class E >
429-
std::tuple<UniqueArrayElements<E>, jboolean> GetArrayElements(JNIEnv& env, jarray<E>& array)
429+
std::tuple<UniqueArrayElements<E>, bool> GetArrayElements(JNIEnv& env, jarray<E>& array)
430430
{
431431
::jboolean isCopy = JNI_FALSE;
432432
E* result = CheckJavaException(env,
433433
(env.*(TypedMethods<E>::GetArrayElements))(Unwrap(array), &isCopy));
434-
return std::make_tuple(UniqueArrayElements<E>(result, ArrayElementsDeleter<E>(env, array)), Wrap<jboolean>(isCopy));
434+
return std::make_tuple(UniqueArrayElements<E>(result, ArrayElementsDeleter<E>(env, array)), isCopy);
435435
}
436436

437437
template < class E >
@@ -449,12 +449,12 @@ namespace jni
449449
}
450450

451451
template < class E >
452-
std::tuple<UniquePrimitiveArrayCritical<E>, jboolean> GetPrimitiveArrayCritical(JNIEnv& env, jarray<E>& array)
452+
std::tuple<UniquePrimitiveArrayCritical<E>, bool> GetPrimitiveArrayCritical(JNIEnv& env, jarray<E>& array)
453453
{
454454
::jboolean isCopy = JNI_FALSE;
455455
void* result = CheckJavaException(env,
456456
env.GetPrimitiveArrayCritical(Unwrap(array), &isCopy));
457-
return std::make_tuple(UniquePrimitiveArrayCritical<E>(result, PrimitiveArrayCriticalDeleter<E>(env, array)), Wrap<jboolean>(isCopy));
457+
return std::make_tuple(UniquePrimitiveArrayCritical<E>(result, PrimitiveArrayCriticalDeleter<E>(env, array)), isCopy);
458458
}
459459

460460
template < class E >

0 commit comments

Comments
 (0)