Skip to content

Remove UnsafeCursor from the JNI API #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 14, 2025
Merged

Conversation

swankjesse
Copy link
Collaborator

We should be able to split the Zstd+KMP stuff from the Zstd+Okio stuff.

@swankjesse swankjesse requested a review from yschimke July 14, 2025 03:11
auto inputByteArrayElements = env->GetByteArrayElements(inputByteArray, NULL);
auto inputEnd = static_cast<size_t>(env->GetIntField(input, jniZstd->unsafeCursorEnd));
Copy link
Collaborator

@yschimke yschimke Jul 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems in hindsight like an obvious improvement. Much simpler to have one side knowing the internals of the other, than both sides reaching around.

assertThat(remaining).isEqualTo(0)

return output.data!!.toByteString(outputOffset, compressor.outputBytesProcessed)
return outputArray.toByteString(outputOffset, compressor.outputBytesProcessed)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

outputOffset is used surprisingly, it seems it could always be 0 if outputArray is always freshly created. Is this for testing?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, in practice it’ll be non-zero and I want to confirm the native code handles that okay.

Base automatically changed from jwilson.0711.android to main July 14, 2025 11:36
We should be able to split the Zstd+KMP stuff from
the Zstd+Okio stuff.
@swankjesse swankjesse force-pushed the jwilson.0713.okio_kmm branch from f38036d to 019d78d Compare July 14, 2025 13:37
@swankjesse swankjesse merged commit f1e22fd into main Jul 14, 2025
6 checks passed
@swankjesse swankjesse deleted the jwilson.0713.okio_kmm branch July 14, 2025 18:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants