Skip to content

Commit

Permalink
Merge pull request uclouvain#1520 from brad0/openbsd_swap16
Browse files Browse the repository at this point in the history
Fix building on OpenBSD big endian hosts
  • Loading branch information
rouault authored Mar 4, 2024
2 parents c28f012 + 995d8c9 commit 0fe2a2c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/bin/jp2/convert.c
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,7 @@ static int tga_readheader(FILE *fp, unsigned int *bits_per_pixel,

#ifdef OPJ_BIG_ENDIAN

static INLINE OPJ_UINT16 swap16(OPJ_UINT16 x)
static INLINE OPJ_UINT16 opj_swap16(OPJ_UINT16 x)
{
return (OPJ_UINT16)(((x & 0x00ffU) << 8) | ((x & 0xff00U) >> 8));
}
Expand Down Expand Up @@ -733,8 +733,8 @@ static int tga_writeheader(FILE *fp, int bits_per_pixel, int width, int height,
goto fails;
}
#else
image_w = swap16(image_w);
image_h = swap16(image_h);
image_w = opj_swap16(image_w);
image_h = opj_swap16(image_h);
if (fwrite(&image_w, 2, 1, fp) != 1) {
goto fails;
}
Expand Down

0 comments on commit 0fe2a2c

Please sign in to comment.