Fix compression on big-endian architecture #120

Merged
merged 1 commit into from Jan 9, 2014

Projects

None yet

2 participants

@vincentbernat

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.

@vincentbernat vincentbernat Fix compression on big-endian architecture
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.
98e7e6b
@mkoppanen mkoppanen merged commit 304806f into php-memcached-dev:master Jan 9, 2014

1 check passed

Details default The Travis CI build passed
@mkoppanen
php-memcached-dev 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

I don't think it is worth it.

@mkoppanen
php-memcached-dev 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