Skip to content

Commit

Permalink
Merge pull request #521 from manisandro/bigendian
Browse files Browse the repository at this point in the history
Fix opj_write_bytes_BE
Fixes #472 
Fixes #345 
Fixes #518
  • Loading branch information
mayeut committed Jul 25, 2015
2 parents ffd9db9 + c665e81 commit 8c4afef
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lib/openjp2/cio.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@

void opj_write_bytes_BE (OPJ_BYTE * p_buffer, OPJ_UINT32 p_value, OPJ_UINT32 p_nb_bytes)
{
const OPJ_BYTE * l_data_ptr = ((const OPJ_BYTE *) &p_value) + p_nb_bytes;
const OPJ_BYTE * l_data_ptr = ((const OPJ_BYTE *) &p_value)+sizeof(OPJ_UINT32)-p_nb_bytes;

assert(p_nb_bytes > 0 && p_nb_bytes <= sizeof(OPJ_UINT32));

Expand All @@ -72,7 +72,7 @@ void opj_read_bytes_BE(const OPJ_BYTE * p_buffer, OPJ_UINT32 * p_value, OPJ_UINT
assert(p_nb_bytes > 0 && p_nb_bytes <= sizeof(OPJ_UINT32));

*p_value = 0;
memcpy(l_data_ptr+4-p_nb_bytes,p_buffer,p_nb_bytes);
memcpy(l_data_ptr+sizeof(OPJ_UINT32)-p_nb_bytes,p_buffer,p_nb_bytes);
}

void opj_read_bytes_LE(const OPJ_BYTE * p_buffer, OPJ_UINT32 * p_value, OPJ_UINT32 p_nb_bytes)
Expand Down

0 comments on commit 8c4afef

Please sign in to comment.