[wpiutil] jni_util: Add JSpan and CriticalJSpan (#5554)

These replace JArrayRef et al and support statically sized arrays similar to std::span.
This commit is contained in:
Joseph Eng
2023-08-24 00:02:56 -07:00
committed by GitHub
parent 8f3d6a1d4b
commit 2e4ad35e36
19 changed files with 333 additions and 317 deletions

View File

@@ -261,11 +261,10 @@ Java_edu_wpi_first_hal_SerialPortJNI_serialWrite
(JNIEnv* env, jclass, jint handle, jbyteArray dataToSend, jint size)
{
int32_t status = 0;
jint retVal =
HAL_WriteSerial(static_cast<HAL_SerialPortHandle>(handle),
reinterpret_cast<const char*>(
JByteArrayRef(env, dataToSend).array().data()),
size, &status);
jint retVal = HAL_WriteSerial(
static_cast<HAL_SerialPortHandle>(handle),
reinterpret_cast<const char*>(JSpan<const jbyte>(env, dataToSend).data()),
size, &status);
CheckStatus(env, status);
return retVal;
}