[sane-devel] [PATCH] Swap bytes in 16-bit PNGs, because PNG is big-endian.

Olaf Meeuwissen paddy-hack at member.fsf.org
Thu Apr 27 12:51:31 UTC 2017


Hi Aaron,

Thanks for the patch but it is incorrect on big-endian architectures.
>From 3.2.1 Image Transmission in the SANE API specification:

  Conceptually, each frame is transmitted a byte at a time.  Each byte
  may contain 8 sample values (for an image bit depth of 1), one full
  sample value (for an image bit depth of 8), or a partial sample value
  (for an image bit depth of 16 or bigger).  In the latter case, the
  bytes of each sample value are transmitted in the machine’s native
  byte order.

Your patch should only be activated on little-endian machines, not on
big-endian ones.  I've fixed that up in a follow-up commit and pushed
both to Alioth.

BTW, your v2 and v3 patches were the same (for all I could see) so I
ignored those ;-)
--
Olaf Meeuwissen, LPIC-2            FSF Associate Member since 2004-01-27
 GnuPG key: F84A2DD9/B3C0 2F47 EA19 64F4 9F13  F43E B8A4 A88A F84A 2DD9
 Support Free Software                        https://my.fsf.org/donate
 Join the Free Software Foundation              https://my.fsf.org/join



More information about the sane-devel mailing list