Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change integer for version libtiff 4.3.0 #1377

Merged
merged 2 commits into from
Sep 12, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions src/bin/jp2/converttif.c
Original file line number Diff line number Diff line change
Expand Up @@ -568,8 +568,13 @@ int imagetotif(opj_image_t * image, const char *outfile)
{
TIFF *tif;
tdata_t buf;
#if TIFF_VERSION_BIG >= 43
uint32_t width, height;
uint16_t bps, tiPhoto;
#else
uint32 width, height;
uint16 bps, tiPhoto;
#endif
int adjust, sgnd;
int64_t strip_size, rowStride, TIFF_MAX;
OPJ_UINT32 i, numcomps;
Expand All @@ -578,7 +583,11 @@ int imagetotif(opj_image_t * image, const char *outfile)
convert_32s_PXCX cvtPxToCx = NULL;
convert_32sXXx_C1R cvt32sToTif = NULL;

#if TIFF_VERSION_BIG >= 43
bps = (uint16_t)image->comps[0].prec;
#else
bps = (uint16)image->comps[0].prec;
#endif
planes[0] = image->comps[0].data;

numcomps = image->numcomps;
Expand Down Expand Up @@ -694,12 +703,21 @@ int imagetotif(opj_image_t * image, const char *outfile)
}
sgnd = (int)image->comps[0].sgnd;
adjust = sgnd ? (int)(1 << (image->comps[0].prec - 1)) : 0;
#if TIFF_VERSION_BIG >= 43
width = (uint32_t)image->comps[0].w;
height = (uint32_t)image->comps[0].h;
#else
width = (uint32)image->comps[0].w;
height = (uint32)image->comps[0].h;
#endif

TIFFSetField(tif, TIFFTAG_IMAGEWIDTH, width);
TIFFSetField(tif, TIFFTAG_IMAGELENGTH, height);
#if TIFF_VERSION_BIG >= 43
TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, (uint16_t)numcomps);
#else
TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, (uint16)numcomps);
#endif
TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, bps);
TIFFSetField(tif, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);
TIFFSetField(tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
Expand Down Expand Up @@ -1259,8 +1277,13 @@ opj_image_t* tiftoimage(const char *filename, opj_cparameters_t *parameters)
OPJ_COLOR_SPACE color_space = OPJ_CLRSPC_UNKNOWN;
opj_image_cmptparm_t cmptparm[4]; /* RGBA */
opj_image_t *image = NULL;
#if TIFF_VERSION_BIG >= 43
uint16_t tiBps, tiPhoto, tiSf, tiSpp, tiPC;
uint32_t tiWidth, tiHeight;
#else
uint16 tiBps, tiPhoto, tiSf, tiSpp, tiPC;
uint32 tiWidth, tiHeight;
#endif
OPJ_BOOL is_cinema = OPJ_IS_CINEMA(parameters->rsiz);
convert_XXx32s_C1R cvtTifTo32s = NULL;
convert_32s_CXPX cvtCxToPx = NULL;
Expand Down