Skip to content

Commit ce269de

Browse files
committed
glue: use the EXCEPTION_CHECK() macro
1 parent 89e76f8 commit ce269de

File tree

4 files changed

+21
-21
lines changed

4 files changed

+21
-21
lines changed

src/main/native/glue/bo/BodyIdArray.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright (c) 2024-2025 Stephen Gold
2+
Copyright (c) 2024-2026 Stephen Gold
33
44
Permission is hereby granted, free of charge, to any person obtaining a copy
55
of this software and associated documentation files (the "Software"), to deal
@@ -50,9 +50,9 @@ JNIEXPORT jlong JNICALL Java_com_github_stephengold_joltjni_BodyIdArray_create
5050
JNIEXPORT jlong JNICALL Java_com_github_stephengold_joltjni_BodyIdArray_createFromBuffer
5151
(JNIEnv *pEnv, jclass, jobject intBuffer) {
5252
const jint * const pIds = (jint *) pEnv->GetDirectBufferAddress(intBuffer);
53-
JPH_ASSERT(!pEnv->ExceptionCheck());
53+
EXCEPTION_CHECK(pEnv);
5454
const jlong numIds = pEnv->GetDirectBufferCapacity(intBuffer);
55-
JPH_ASSERT(!pEnv->ExceptionCheck());
55+
EXCEPTION_CHECK(pEnv);
5656
BodyID * const pArray = new BodyID[numIds];
5757
TRACE_NEW("BodyID[]", pArray)
5858
for (jlong i = 0; i < numIds; ++i) {

src/main/native/glue/d/Decomposer.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -156,17 +156,17 @@ JNIEXPORT void JNICALL Java_com_github_stephengold_joltjni_vhacd_Decomposer_deco
156156

157157
jboolean isCopy;
158158
jfloat * const pPoints = pEnv->GetFloatArrayElements(locations, &isCopy);
159-
JPH_ASSERT(!pEnv->ExceptionCheck());
159+
EXCEPTION_CHECK(pEnv)
160160

161161
const jsize numFloats = pEnv->GetArrayLength(locations);
162-
JPH_ASSERT(!pEnv->ExceptionCheck());
162+
EXCEPTION_CHECK(pEnv)
163163
const int32_t numPoints = numFloats / 3;
164164

165165
jint * const pIndices = pEnv->GetIntArrayElements(indices, &isCopy);
166-
JPH_ASSERT(!pEnv->ExceptionCheck());
166+
EXCEPTION_CHECK(pEnv)
167167

168168
const jsize numIndices = pEnv->GetArrayLength(indices);
169-
JPH_ASSERT(!pEnv->ExceptionCheck());
169+
EXCEPTION_CHECK(pEnv)
170170
const int32_t numTriangles = numIndices / 3;
171171

172172
// on some platforms, jint != uint32_t
@@ -175,7 +175,7 @@ JNIEXPORT void JNICALL Java_com_github_stephengold_joltjni_vhacd_Decomposer_deco
175175
pCopyIndices[i] = (uint32_t) pIndices[i];
176176
}
177177
pEnv->ReleaseIntArrayElements(indices, pIndices, JNI_ABORT);
178-
JPH_ASSERT(!pEnv->ExceptionCheck());
178+
EXCEPTION_CHECK(pEnv)
179179

180180
const IVHACD::Parameters * const pParams
181181
= reinterpret_cast<IVHACD::Parameters *> (paramsVa);
@@ -191,7 +191,7 @@ JNIEXPORT void JNICALL Java_com_github_stephengold_joltjni_vhacd_Decomposer_deco
191191
delete[] pCopyIndices;
192192

193193
pEnv->ReleaseFloatArrayElements(locations, pPoints, JNI_ABORT);
194-
JPH_ASSERT(!pEnv->ExceptionCheck());
194+
EXCEPTION_CHECK(pEnv)
195195
}
196196

197197
/*
@@ -211,10 +211,10 @@ JNIEXPORT void JNICALL Java_com_github_stephengold_joltjni_vhacd_Decomposer_deco
211211

212212
const jint * const pIndices
213213
= (jint *) pEnv->GetDirectBufferAddress(indices);
214-
JPH_ASSERT(!pEnv->ExceptionCheck());
214+
EXCEPTION_CHECK(pEnv)
215215

216216
const jlong numIndices = pEnv->GetDirectBufferCapacity(indices);
217-
JPH_ASSERT(!pEnv->ExceptionCheck());
217+
EXCEPTION_CHECK(pEnv)
218218
const int32_t numTriangles = numIndices / 3;
219219

220220
// on some platforms, jint != uint32_t

src/main/native/glue/m/MutableCompoundShape.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright (c) 2024-2025 Stephen Gold
2+
Copyright (c) 2024-2026 Stephen Gold
33
44
Permission is hereby granted, free of charge, to any person obtaining a copy
55
of this software and associated documentation files (the "Software"), to deal
@@ -89,10 +89,10 @@ JNIEXPORT void JNICALL Java_com_github_stephengold_joltjni_MutableCompoundShape_
8989
= reinterpret_cast<MutableCompoundShape *> (shapeVa);
9090
const Vec3 * const pOffsets
9191
= (Vec3 *) pEnv->GetDirectBufferAddress(offsets);
92-
JPH_ASSERT(!pEnv->ExceptionCheck());
92+
EXCEPTION_CHECK(pEnv);
9393
const Quat * const pRotations
9494
= (Quat *) pEnv->GetDirectBufferAddress(rotations);
95-
JPH_ASSERT(!pEnv->ExceptionCheck());
95+
EXCEPTION_CHECK(pEnv);
9696
pCompound->ModifyShapes(startIndex, numSubShapes, pOffsets, pRotations,
9797
offsetStride, rotationStride);
9898
uint64 revisionCount = pCompound->GetUserData();

src/main/native/glue/so/SoftBodySharedSettings.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright (c) 2024-2025 Stephen Gold
2+
Copyright (c) 2024-2026 Stephen Gold
33
44
Permission is hereby granted, free of charge, to any person obtaining a copy
55
of this software and associated documentation files (the "Software"), to deal
@@ -441,9 +441,9 @@ JNIEXPORT jint JNICALL Java_com_github_stephengold_joltjni_SoftBodySharedSetting
441441
jobject storeIndices) {
442442
jint * const pStoreInts
443443
= (jint *) pEnv->GetDirectBufferAddress(storeIndices);
444-
JPH_ASSERT(!pEnv->ExceptionCheck());
444+
EXCEPTION_CHECK(pEnv)
445445
const jlong capacityInts = pEnv->GetDirectBufferCapacity(storeIndices);
446-
JPH_ASSERT(!pEnv->ExceptionCheck());
446+
EXCEPTION_CHECK(pEnv)
447447
const SoftBodySharedSettings * const pSettings
448448
= reinterpret_cast<SoftBodySharedSettings *> (settingsVa);
449449
const Array<SoftBodySharedSettings::Edge>& edges
@@ -467,9 +467,9 @@ JNIEXPORT jint JNICALL Java_com_github_stephengold_joltjni_SoftBodySharedSetting
467467
jobject storeIndices) {
468468
jint * const pStoreInts
469469
= (jint *) pEnv->GetDirectBufferAddress(storeIndices);
470-
JPH_ASSERT(!pEnv->ExceptionCheck());
470+
EXCEPTION_CHECK(pEnv)
471471
const jlong capacityInts = pEnv->GetDirectBufferCapacity(storeIndices);
472-
JPH_ASSERT(!pEnv->ExceptionCheck());
472+
EXCEPTION_CHECK(pEnv)
473473
const SoftBodySharedSettings * const pSettings
474474
= reinterpret_cast<SoftBodySharedSettings *> (settingsVa);
475475
const Array<SoftBodySharedSettings::Face>& faces = pSettings->mFaces;
@@ -493,9 +493,9 @@ JNIEXPORT jint JNICALL Java_com_github_stephengold_joltjni_SoftBodySharedSetting
493493
jobject storeIndices) {
494494
jint * const pStoreInts
495495
= (jint *) pEnv->GetDirectBufferAddress(storeIndices);
496-
JPH_ASSERT(!pEnv->ExceptionCheck());
496+
EXCEPTION_CHECK(pEnv)
497497
const jlong capacityInts = pEnv->GetDirectBufferCapacity(storeIndices);
498-
JPH_ASSERT(!pEnv->ExceptionCheck());
498+
EXCEPTION_CHECK(pEnv)
499499
const SoftBodySharedSettings * const pSettings
500500
= reinterpret_cast<SoftBodySharedSettings *> (settingsVa);
501501
const Array<SoftBodySharedSettings::RodStretchShear>& rods

0 commit comments

Comments
 (0)