diff options
-rw-r--r-- | java/jni/BluetoothGattCharacteristic.cxx | 6 | ||||
-rw-r--r-- | java/jni/BluetoothGattDescriptor.cxx | 6 |
2 files changed, 2 insertions, 10 deletions
diff --git a/java/jni/BluetoothGattCharacteristic.cxx b/java/jni/BluetoothGattCharacteristic.cxx index 6d21e0e6..61cceda4 100644 --- a/java/jni/BluetoothGattCharacteristic.cxx +++ b/java/jni/BluetoothGattCharacteristic.cxx @@ -72,11 +72,7 @@ jboolean Java_tinyb_BluetoothGattCharacteristic_writeValue(JNIEnv *env, jobject jbyte *native_array = env->GetByteArrayElements(argValue, &is_copy); jsize native_array_length = env->GetArrayLength(argValue); - std::vector<unsigned char> array(native_array_length); - for (int i = 0; i < native_array_length; ++i) - { - array.push_back(native_array[i]); - } + std::vector<unsigned char> array(native_array, native_array + native_array_length); return obj_gatt_char->write_value(array) ? JNI_TRUE : JNI_FALSE; } diff --git a/java/jni/BluetoothGattDescriptor.cxx b/java/jni/BluetoothGattDescriptor.cxx index 091e0be9..02b04dbe 100644 --- a/java/jni/BluetoothGattDescriptor.cxx +++ b/java/jni/BluetoothGattDescriptor.cxx @@ -69,11 +69,7 @@ jboolean Java_tinyb_BluetoothGattDescriptor_writeValue(JNIEnv *env, jobject obj, jbyte *native_array = env->GetByteArrayElements(argValue, &is_copy); jsize native_array_length = env->GetArrayLength(argValue); - std::vector<unsigned char> array(native_array_length); - for (int i = 0; i < native_array_length; ++i) - { - array.push_back(native_array[i]); - } + std::vector<unsigned char> array(native_array, native_array + native_array_length); return obj_gatt_desc->write_value(array) ? JNI_TRUE : JNI_FALSE; } |