Ensure vipsload only byte swaps if necessary
Prior to this commit, MSB-ordered vips images were always byte swapped on both little- and big endian systems. And LSB-ordered vips images were loaded without a byte swap. This works correctly on little endian systems, but will not work on big endian systems where the byte swap must be done vice versa. This commit ensures that the byte swap only takes place when needed. See https://github.com/libvips/libvips/issues/1847.
This commit is contained in:
parent
6340e14303
commit
9bb86119e3
|
@ -859,10 +859,7 @@ vips_image_build( VipsObject *object )
|
|||
if( (magic = vips__file_magic( filename )) ) {
|
||||
/* We may need to byteswap.
|
||||
*/
|
||||
guint32 us = vips_amiMSBfirst() ?
|
||||
VIPS_MAGIC_INTEL : VIPS_MAGIC_SPARC;
|
||||
|
||||
if( magic == us ) {
|
||||
if( GUINT_FROM_BE( magic ) == image->magic ) {
|
||||
/* Native open.
|
||||
*/
|
||||
if( vips_image_open_input( image ) )
|
||||
|
|
Loading…
Reference in New Issue