Skip to content

JNA wrapper for <sys/xattr.h>#338

Merged
twall merged 9 commits intojava-native-access:masterfrom
rednoah:master
Jun 20, 2014
Merged

JNA wrapper for <sys/xattr.h>#338
twall merged 9 commits intojava-native-access:masterfrom
rednoah:master

Conversation

@rednoah
Copy link
Copy Markdown
Contributor

@rednoah rednoah commented Jun 18, 2014

Here is my wrapper for <sys/xattr.h> with support for xattr list/get/set/remove.

Tested on OS X 10.9.2

@twall
Copy link
Copy Markdown
Contributor

twall commented Jun 18, 2014

Please add a line to CHANGES.md. Otherwise, LGTM. Kudos for including tests.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

There seems to be some overlap here with Native.toString(byte[]) and Pointer.setString()/setWideString().

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

So if I wanted a Pointer to a NULL-terminated UTF-8 String I'd use Pointer.setString("XYZ", "UTF-8")? In the docs it doesn't explicitly state it will be NULL-terminated. Also String.length() isn't necessarily the byte size once encoded, so will this automatically allocate the necessary memory as well?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pointer.setString() does NUL-terminate, but since you need to allocate space here as well, that function doesn't help much. The class NativeString actually does what you want, but it's package-protected.

I think your code is fine as is.

rednoah added 5 commits June 18, 2014 20:26
change notes for the xattr wrapper
reference pull request
fix reference
@rednoah
Copy link
Copy Markdown
Contributor Author

rednoah commented Jun 18, 2014

ok, fixed changes and null

twall added a commit that referenced this pull request Jun 20, 2014
JNA wrapper for <sys/xattr.h>
@twall twall merged commit 33dcdb0 into java-native-access:master Jun 20, 2014
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.

2 participants