From 28b9522f6e0e9bfda9bae335f3412528bcfea832 Mon Sep 17 00:00:00 2001 From: Matthew Sheby <44249925+msheby@users.noreply.github.com> Date: Thu, 21 Oct 2021 11:15:10 -0700 Subject: [PATCH] switch field from signed int to unsigned int --- src/bin/jp2/opj_compress.c | 6 +++--- src/lib/openjp2/openjpeg.c | 2 +- src/lib/openjp2/openjpeg.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/bin/jp2/opj_compress.c b/src/bin/jp2/opj_compress.c index 2472f6d8..4448f740 100644 --- a/src/bin/jp2/opj_compress.c +++ b/src/bin/jp2/opj_compress.c @@ -914,10 +914,10 @@ static int parse_cmdline_encoder(int argc, char **argv, /* ----------------------------------------------------- */ case 'X': { /* target bitdepth */ - int target_bitdepth = 0; + unsigned int target_bitdepth = 0; char *s = opj_optarg; - sscanf(s, "%d", &target_bitdepth); - if (target_bitdepth <= 0) { + sscanf(s, "%u", &target_bitdepth); + if (target_bitdepth == 0) { fprintf(stderr, "Target bitdepth must be at least 1 bit.\n"); return 1; } diff --git a/src/lib/openjp2/openjpeg.c b/src/lib/openjp2/openjpeg.c index f0db4670..477d3310 100644 --- a/src/lib/openjp2/openjpeg.c +++ b/src/lib/openjp2/openjpeg.c @@ -756,7 +756,7 @@ void OPJ_CALLCONV opj_set_default_encoder_parameters(opj_cparameters_t parameters->tp_on = 0; parameters->decod_format = -1; parameters->cod_format = -1; - parameters->target_bitdepth = -1; + parameters->target_bitdepth = 0; parameters->tcp_rates[0] = 0; parameters->tcp_numlayers = 0; parameters->cp_disto_alloc = 0; diff --git a/src/lib/openjp2/openjpeg.h b/src/lib/openjp2/openjpeg.h index 21bc48e7..68c15b7f 100644 --- a/src/lib/openjp2/openjpeg.h +++ b/src/lib/openjp2/openjpeg.h @@ -466,7 +466,7 @@ typedef struct opj_cparameters { /** output file format 0: J2K, 1: JP2, 2: JPT */ int cod_format; /** desired bitdepth from input file */ - int target_bitdepth; + unsigned int target_bitdepth; /*@}*/ /* UniPG>> */ /* NOT YET USED IN THE V2 VERSION OF OPENJPEG */