You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Damjan Jovanovic (Commented) (JIRA)" <ji...@apache.org> on 2011/10/15 07:30:13 UTC

[jira] [Commented] (SANSELAN-54) Tiff (exif) tags of type double written in wrong byte order

    [ https://issues.apache.org/jira/browse/SANSELAN-54?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13128079#comment-13128079 ] 

Damjan Jovanovic commented on SANSELAN-54:
------------------------------------------

Nice spot. I've written a test and also patched convertByteArrayToDouble() - it's wrong after all, because it does things like "(0xff & byte0) << 56", but Java only uses the lowest 5 bits (max 32 places) when left-shifting an int, so it actually needs "(0xffL & byte0) << 56" to force conversion to long before the left-shift. I'm about to commit everything now, thank you for your contribution.

                
> Tiff (exif) tags of type double written in wrong byte order
> -----------------------------------------------------------
>
>                 Key: SANSELAN-54
>                 URL: https://issues.apache.org/jira/browse/SANSELAN-54
>             Project: Commons Sanselan
>          Issue Type: Bug
>         Environment: Tested under Windows XP.  Potentally all platforms.
>            Reporter: Gary Lucas
>         Attachments: Sanselan-54-ExifByteOrder.patch
>
>
> Reviewing BinaryFileFunctions.java method convertDoubleToByteArray and convertDoubleArrayToByteArray there are two blocks of code, one for BYTE_ORDER_MOTOROLA (big endian) and one for BYTE_ORDER_INTEL (little endian).  These are backwards.  
> The convertByteArrayToDouble, on the other hand appears to be correct.  A reasonable test procedure would be to see if these two sets of methods are mutually consistent.
> The same problem appears to be the case for the "Float" variants, but not the Integer variants.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira