Skip to content

Fix compression on big-endian architecture #120

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

Conversation

vincentbernat
Copy link
Contributor

On big-endian architecture where size_t is a 64-bit long,
copying the 4 first bytes as the size is incorrect. We cast it to an
unsigned 32-bit integer before copying it at the beginning of the
provided buffer.

On big-endian architecture where size_t is a 64-bit long,
copying the 4 first bytes as the size is incorrect. We cast it to an
unsigned 32-bit integer before copying it at the beginning of the
provided buffer.
mkoppanen pushed a commit that referenced this pull request Jan 9, 2014
Fix compression on big-endian architecture
@mkoppanen mkoppanen merged commit 304806f into php-memcached-dev:master Jan 9, 2014
@mkoppanen
Copy link
Member

Looking at this I guess ideally storing network ordered and converting to host byte order on receive would make most change (but also break backwards compatibility).

@vincentbernat
Copy link
Contributor Author

I don't think it is worth it.

@mkoppanen
Copy link
Member

I opened a pull, which fixes the issue in a backwards compatible manner. Haven't merged yet because not sure if it's worth it (in practice x86/x86-64 will be used by the majority).

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