@@ -64,8 +64,10 @@ using pdal::pdal_error;
6464// / \param[in] dims JavaArray of DimTypes
6565// / \param[in] bufSize Dims sum size
6666// / \param[in] dimTypes Vector of DimTypes
67- void convertDimTypeJavaArrayToVector (JNIEnv *env, jobjectArray dims, std::size_t *pointSize, DimTypeList *dimTypes, PointLayoutPtr pl) {
68- for (jint i = 0 ; i < env->GetArrayLength (dims); i++) {
67+ void convertDimTypeJavaArrayToVector (JNIEnv *env, jobjectArray dims, std::size_t *pointSize, DimTypeList *dimTypes, PointLayoutPtr pl)
68+ {
69+ for (jint i = 0 ; i < env->GetArrayLength (dims); i++)
70+ {
6971 jobject jDimType = reinterpret_cast <jobject>(env->GetObjectArrayElement (dims, i));
7072 jclass cDimType = env->GetObjectClass (jDimType);
7173 jfieldID fid = env->GetFieldID (cDimType, " id" , " Ljava/lang/String;" );
@@ -192,7 +194,8 @@ JNIEXPORT jbyteArray JNICALL Java_io_pdal_PointView_getPackedPoints
192194 std::size_t bufSize = pointSize * pv->size ();
193195 char *buf = new char [bufSize];
194196
195- for (PointId idx = 0 ; idx < pv->size (); idx++) {
197+ for (PointId idx = 0 ; idx < pv->size (); idx++)
198+ {
196199 appendPackedPoint (pv, dimTypes, idx, pointSize, buf);
197200 }
198201
@@ -269,8 +272,8 @@ JNIEXPORT jdoubleArray JNICALL Java_io_pdal_PointView_rasterizeTriangularMesh
269272
270273 jdoubleArray result = env->NewDoubleArray (length);
271274
272- double buffer[length];
273- std::fill (buffer, buffer + sizeof (buffer) / sizeof ( double ) , strtod (" NaN" , NULL ));
275+ double * buffer = new double [length];
276+ std::fill (buffer, buffer + length , strtod (" NaN" , NULL ));
274277
275278 for (int id = 0 ; id < size; id++)
276279 {
@@ -391,6 +394,8 @@ JNIEXPORT jdoubleArray JNICALL Java_io_pdal_PointView_rasterizeTriangularMesh
391394
392395 env->SetDoubleArrayRegion (result, 0 , length, buffer);
393396
397+ delete[] buffer;
398+
394399 return result;
395400}
396401
0 commit comments