diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2017-09-20 00:55:22 +0200 |
|---|---|---|
| committer | Even Rouault <even.rouault@spatialys.com> | 2017-09-20 00:55:22 +0200 |
| commit | b8c4b450c4b5bec649463573f57235c4f41c57cd (patch) | |
| tree | d9d651fb6c16b48480d5eb1e7329d5fd57752b89 /src | |
| parent | 9cba05762ded66b803df94b00adbd5a97727da95 (diff) | |
Use a #define J2K_MAX_POCS 32 to avoid hard-coded constant (#349)
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/openjp2/j2k.c | 3 | ||||
| -rw-r--r-- | src/lib/openjp2/j2k.h | 4 |
2 files changed, 4 insertions, 3 deletions
diff --git a/src/lib/openjp2/j2k.c b/src/lib/openjp2/j2k.c index be2da8ec..36d4e947 100644 --- a/src/lib/openjp2/j2k.c +++ b/src/lib/openjp2/j2k.c @@ -3502,11 +3502,10 @@ static OPJ_BOOL opj_j2k_read_poc(opj_j2k_t *p_j2k, l_old_poc_nb = l_tcp->POC ? l_tcp->numpocs + 1 : 0; l_current_poc_nb += l_old_poc_nb; - if (l_current_poc_nb >= 32) { + if (l_current_poc_nb >= J2K_MAX_POCS) { opj_event_msg(p_manager, EVT_ERROR, "Too many POCs %d\n", l_current_poc_nb); return OPJ_FALSE; } - assert(l_current_poc_nb < 32); /* now poc is in use.*/ l_tcp->POC = 1; diff --git a/src/lib/openjp2/j2k.h b/src/lib/openjp2/j2k.h index c9308f7d..d975419e 100644 --- a/src/lib/openjp2/j2k.h +++ b/src/lib/openjp2/j2k.h @@ -107,6 +107,8 @@ The functions in J2K.C have for goal to read/write the several parts of the code #endif /* USE_JPSEC */ /* <<UniPG */ +#define J2K_MAX_POCS 32 /**< Maximum number of POCs */ + /* ----------------------------------------------------------------------- */ /** @@ -251,7 +253,7 @@ typedef struct opj_tcp { /** number of progression order changes */ OPJ_UINT32 numpocs; /** progression order changes */ - opj_poc_t pocs[32]; + opj_poc_t pocs[J2K_MAX_POCS]; /** number of ppt markers (reserved size) */ OPJ_UINT32 ppt_markers_count; |
