Skip to content

LARGE_INTEGER needs to populate both union fields#1196

Merged
matthiasblaesing merged 2 commits intojava-native-access:masterfrom
dbwiddis:largeintfix
May 17, 2020
Merged

LARGE_INTEGER needs to populate both union fields#1196
matthiasblaesing merged 2 commits intojava-native-access:masterfrom
dbwiddis:largeintfix

Conversation

@dbwiddis
Copy link
Copy Markdown
Contributor

As discussed on the mailing list. Initial commit is a failing test case.

@dbwiddis dbwiddis marked this pull request as ready for review May 17, 2020 15:33
@dbwiddis
Copy link
Copy Markdown
Contributor Author

Fixed by overriding read() in the union to explicitly read both fields. Test now passes.

@matthiasblaesing
Copy link
Copy Markdown
Member

Looks good to me. Thank you.

@matthiasblaesing matthiasblaesing merged commit 2afa6da into java-native-access:master May 17, 2020
@dbwiddis dbwiddis deleted the largeintfix branch May 17, 2020 19:31
@dbwiddis
Copy link
Copy Markdown
Contributor Author

My CI just pointed out an inconsistency with other methods. Should the overridden read call super.read()? Looking at the code I don't think it's necessary in this specific case but might be a good idea.

@matthiasblaesing
Copy link
Copy Markdown
Member

I don't see a problem. Structure#read basicly cycles through all structure fields and calls readField on them. Union overrides this and blocks reads from fields, that don't belong to the current selected type.

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