Skip to content

Commit

Permalink
glue: avoid using "int" and "uint" types in calculations
Browse files Browse the repository at this point in the history
  • Loading branch information
stephengold committed Jan 18, 2025
1 parent 7a232ad commit 5909e1e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/main/native/glue/co/CompoundShape.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ JNIEXPORT void JNICALL Java_com_github_stephengold_joltjni_CompoundShape_restore
CompoundShape * const pCompound
= reinterpret_cast<CompoundShape *> (shapeVa);
const ShapeList * const pList = reinterpret_cast<ShapeList *> (listVa);
const uint numShapes = pList->size();
const ShapeList::size_type numShapes = pList->size();
ShapeRefC * const pSubShapes = new ShapeRefC[numShapes];
for (size_t i = 0; i < numShapes; ++i) {
pSubShapes[i] = pList->at(i);
Expand Down
2 changes: 1 addition & 1 deletion src/main/native/glue/co/ConvexHullBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ JNIEXPORT jlong JNICALL Java_com_github_stephengold_joltjni_ConvexHullBuilder_cr
const jfloat * const pPoints
= (jfloat *) pEnv->GetDirectBufferAddress(pointBuffer);
const jlong numFloats = pEnv->GetDirectBufferCapacity(pointBuffer);
const int numPoints = numFloats / 3;
const uint64 numPoints = numFloats / 3;
Array<Vec3> * const pArray = new Array<Vec3>(); // TODO memory leak
TRACE_NEW("Array<Vec3>", pArray)
for (uint64 i = 0; i < numPoints; ++i) {
Expand Down
6 changes: 3 additions & 3 deletions src/main/native/glue/sh/Shape.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (c) 2024 Stephen Gold
Copyright (c) 2024-2025 Stephen Gold
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -59,8 +59,8 @@ JNIEXPORT void JNICALL Java_com_github_stephengold_joltjni_Shape_copyDebugTriang
pSh->GetTrianglesStart(context, AABox::sBiggest(),
Vec3::sZero(), Quat::sIdentity(), Vec3::sReplicate(1.0f));
while (numTriangles > 0) {
const int maxRequest = std::max((int) numTriangles,
Shape::cGetTrianglesMinTrianglesRequested);
const int32_t maxRequest = std::max(numTriangles,
(int32_t)Shape::cGetTrianglesMinTrianglesRequested);
const int numTrianglesCopied
= pSh->GetTrianglesNext(context, maxRequest, pFloat3);
JPH_ASSERT(numTrianglesCopied <= numTriangles);
Expand Down
4 changes: 2 additions & 2 deletions src/main/native/glue/t/TrackedVehicleControllerSettings.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (c) 2024 Stephen Gold
Copyright (c) 2024-2025 Stephen Gold
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -50,7 +50,7 @@ JNIEXPORT jlong JNICALL Java_com_github_stephengold_joltjni_TrackedVehicleContro
*/
JNIEXPORT jint JNICALL Java_com_github_stephengold_joltjni_TrackedVehicleControllerSettings_getNumTracks
(JNIEnv *, jclass, jlong) {
const int result = (int) ETrackSide::Num;
const jint result = (jint) ETrackSide::Num;
return result;
}

Expand Down

0 comments on commit 5909e1e

Please sign in to comment.