Skip to content

Commit

Permalink
feature(user attachment): refactor JNIQuery
Browse files Browse the repository at this point in the history
  • Loading branch information
DariusIMP committed Feb 19, 2024
1 parent 3c696a1 commit f48bd92
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion zenoh-jni/src/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ use crate::{
/// - `sample_kind`: The kind of sample.
/// - `timestamp_enabled`: A boolean indicating whether the timestamp is enabled.
/// - `timestamp_ntp_64`: The NTP64 timestamp value.
/// - `attachment`: The user attachment bytes.
/// - `attachment`: Optional user attachment encoded as a byte array. May be null.
///
/// Safety:
/// - This function is marked as unsafe due to raw pointer manipulation and JNI interaction.
Expand Down
4 changes: 2 additions & 2 deletions zenoh-kotlin/src/commonMain/kotlin/io/zenoh/jni/JNIQuery.kt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ internal class JNIQuery(private val ptr: Long) {
sample.kind.ordinal,
timestampEnabled,
if (timestampEnabled) sample.timestamp!!.ntpValue() else 0,
sample.attachment?.let { encodeAttachment(it) } ?: run { byteArrayOf() },
sample.attachment?.let { encodeAttachment(it) },
)
}

Expand All @@ -57,7 +57,7 @@ internal class JNIQuery(private val ptr: Long) {
sampleKind: Int,
timestampEnabled: Boolean,
timestampNtp64: Long,
attachment: ByteArray,
attachment: ByteArray?,
)

@Throws(Exception::class)
Expand Down

0 comments on commit f48bd92

Please sign in to comment.