Skip to content
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

Add WritePackFunction and ReadPackFunction natives #122

Merged
merged 1 commit into from Aug 12, 2014

Conversation

peace-maker
Copy link
Member

Adds type safety to CDataPack. Cells can't be read as Float anymore. Now
you're able to store a function pointer in a datapack and be sure the
pointer can't be read as a cell and a cell can't be read as a function
pointer.

1 more byte is used in the datapack data stream per entry to store the type now.

Adds type safety to CDataPack. Cells can't be read as Float anymore. Now
you're able to store a function pointer in a datapack and be sure the
pointer can't be read as a cell and a cell can't be read as a function
pointer.
@dvander
Copy link
Member

dvander commented Aug 12, 2014

Looks good.

dvander added a commit that referenced this pull request Aug 12, 2014
Add WritePackFunction and ReadPackFunction natives
@dvander dvander merged commit 4b8e264 into alliedmodders:master Aug 12, 2014
@peace-maker peace-maker deleted the datapack_funcpointer branch August 14, 2014 20:46
@GoD-Tony
Copy link
Contributor

1 more byte is used in the datapack data stream per entry to store the type now.

A quick note to say that this breaks plugins that used SetPackPosition to pull data from an arbitrary point in a stream. If that wasn't the intended use of the function then it's not important, but it has been used that way in a few cases.

@asherkin
Copy link
Member

SetPackPosition should only ever be used with the return value of a previous GetPackPosition, the packing format has always been an implementation detail.

The docs could probably call this out better.

@GoD-Tony
Copy link
Contributor

Good point about GetPackPosition, it makes way more sense to store that value and use it again later.

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.

None yet

4 participants