diff options
| author | Even Rouault <even.rouault@mines-paris.org> | 2017-05-23 16:15:55 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-05-23 16:15:55 +0200 |
| commit | 53d46fc7330ed652db66aa37b498fbfa27be625c (patch) | |
| tree | f5b9b8aca95f11a51c37386c9bd2917606140550 /src/lib | |
| parent | 6e97d877b155aff55d1ae1fef4a36fa56d51e472 (diff) | |
| parent | a8ca7c51f38a4cbdcb4a541137478df03e5eb76d (diff) | |
Merge pull request #936 from rouault/master_warnings
CMake: add stronger warnings for openjp2 lib/bin by default, and error out on declaration-after-statement
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/openjp2/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | src/lib/openjp2/j2k.c | 53 | ||||
| -rw-r--r-- | src/lib/openjp2/jp2.c | 9 |
3 files changed, 62 insertions, 2 deletions
diff --git a/src/lib/openjp2/CMakeLists.txt b/src/lib/openjp2/CMakeLists.txt index af394f6b..cfc49028 100644 --- a/src/lib/openjp2/CMakeLists.txt +++ b/src/lib/openjp2/CMakeLists.txt @@ -95,7 +95,7 @@ if(UNIX) endif() set_target_properties(${OPENJPEG_LIBRARY_NAME} PROPERTIES ${OPENJPEG_LIBRARY_PROPERTIES}) if(${CMAKE_VERSION} VERSION_GREATER "2.8.11") - target_compile_options(${OPENJPEG_LIBRARY_NAME} PRIVATE ${OPENJPEG_LIBRARY_COMPILE_OPTIONS}) + target_compile_options(${OPENJPEG_LIBRARY_NAME} PRIVATE ${OPENJP2_COMPILE_OPTIONS}) endif() # Install library diff --git a/src/lib/openjp2/j2k.c b/src/lib/openjp2/j2k.c index 980a8467..4c2b9326 100644 --- a/src/lib/openjp2/j2k.c +++ b/src/lib/openjp2/j2k.c @@ -48,6 +48,8 @@ /** @name Local static functions */ /*@{*/ +#define OPJ_UNUSED(x) (void)x + /** * Sets up the procedures to do on reading header. Developpers wanting to extend the library can add their own reading procedures. */ @@ -1791,6 +1793,9 @@ static OPJ_BOOL opj_j2k_calculate_tp(opj_j2k_t *p_j2k, assert(p_j2k != 00); assert(p_manager != 00); + OPJ_UNUSED(p_j2k); + OPJ_UNUSED(p_manager); + l_nb_tiles = cp->tw * cp->th; * p_nb_tiles = 0; tcp = cp->tcps; @@ -2505,7 +2510,11 @@ static OPJ_BOOL opj_j2k_read_com(opj_j2k_t *p_j2k, assert(p_j2k != 00); assert(p_manager != 00); assert(p_header_data != 00); - (void)p_header_size; + + OPJ_UNUSED(p_j2k); + OPJ_UNUSED(p_header_data); + OPJ_UNUSED(p_header_size); + OPJ_UNUSED(p_manager); return OPJ_TRUE; } @@ -3284,6 +3293,8 @@ static void opj_j2k_write_poc_in_memory(opj_j2k_t *p_j2k, assert(p_j2k != 00); assert(p_manager != 00); + OPJ_UNUSED(p_manager); + l_tcp = &p_j2k->m_cp.tcps[p_j2k->m_current_tile_number]; l_tccp = &l_tcp->tccps[0]; l_image = p_j2k->m_private_image; @@ -3523,6 +3534,8 @@ static OPJ_BOOL opj_j2k_read_crg(opj_j2k_t *p_j2k, assert(p_j2k != 00); assert(p_manager != 00); + OPJ_UNUSED(p_header_data); + l_nb_comp = p_j2k->m_private_image->numcomps; if (p_header_size != l_nb_comp * 4) { @@ -3564,6 +3577,8 @@ static OPJ_BOOL opj_j2k_read_tlm(opj_j2k_t *p_j2k, assert(p_j2k != 00); assert(p_manager != 00); + OPJ_UNUSED(p_j2k); + if (p_header_size < 2) { opj_event_msg(p_manager, EVT_ERROR, "Error reading TLM marker\n"); return OPJ_FALSE; @@ -3621,6 +3636,9 @@ static OPJ_BOOL opj_j2k_read_plm(opj_j2k_t *p_j2k, assert(p_j2k != 00); assert(p_manager != 00); + OPJ_UNUSED(p_j2k); + OPJ_UNUSED(p_header_data); + if (p_header_size < 1) { opj_event_msg(p_manager, EVT_ERROR, "Error reading PLM marker\n"); return OPJ_FALSE; @@ -3693,6 +3711,8 @@ static OPJ_BOOL opj_j2k_read_plt(opj_j2k_t *p_j2k, assert(p_j2k != 00); assert(p_manager != 00); + OPJ_UNUSED(p_j2k); + if (p_header_size < 1) { opj_event_msg(p_manager, EVT_ERROR, "Error reading PLT marker\n"); return OPJ_FALSE; @@ -4156,6 +4176,9 @@ static OPJ_BOOL opj_j2k_write_sot(opj_j2k_t *p_j2k, assert(p_manager != 00); assert(p_stream != 00); + OPJ_UNUSED(p_stream); + OPJ_UNUSED(p_manager); + opj_write_bytes(p_data, J2K_MS_SOT, 2); /* SOT */ p_data += 2; @@ -4520,6 +4543,8 @@ static OPJ_BOOL opj_j2k_write_sod(opj_j2k_t *p_j2k, assert(p_manager != 00); assert(p_stream != 00); + OPJ_UNUSED(p_stream); + opj_write_bytes(p_data, J2K_MS_SOD, 2); /* SOD */ p_data += 2; @@ -4916,6 +4941,8 @@ static OPJ_BOOL opj_j2k_update_rates(opj_j2k_t *p_j2k, assert(p_manager != 00); assert(p_stream != 00); + OPJ_UNUSED(p_manager); + l_cp = &(p_j2k->m_cp); l_image = p_j2k->m_private_image; l_tcp = l_cp->tcps; @@ -5124,6 +5151,8 @@ static OPJ_BOOL opj_j2k_get_end_header(opj_j2k_t *p_j2k, assert(p_manager != 00); assert(p_stream != 00); + OPJ_UNUSED(p_manager); + p_j2k->cstr_index->main_head_end = opj_stream_tell(p_stream); return OPJ_TRUE; @@ -5264,6 +5293,8 @@ static OPJ_BOOL opj_j2k_write_epc(opj_j2k_t *p_j2k, assert(p_manager != 00); assert(p_stream != 00); + OPJ_UNUSED(p_manager); + l_cstr_index = p_j2k->cstr_index; if (l_cstr_index) { l_cstr_index->codestream_size = (OPJ_UINT64)opj_stream_tell(p_stream); @@ -7291,6 +7322,9 @@ static OPJ_BOOL opj_j2k_mct_validation(opj_j2k_t * p_j2k, assert(p_stream != 00); assert(p_manager != 00); + OPJ_UNUSED(p_stream); + OPJ_UNUSED(p_manager); + if ((p_j2k->m_cp.rsiz & 0x8200) == 0x8200) { OPJ_UINT32 l_nb_tiles = p_j2k->m_cp.th * p_j2k->m_cp.tw; opj_tcp_t * l_tcp = p_j2k->m_cp.tcps; @@ -7510,6 +7544,8 @@ static OPJ_BOOL opj_j2k_encoding_validation(opj_j2k_t * p_j2k, assert(p_stream != 00); assert(p_manager != 00); + OPJ_UNUSED(p_stream); + /* STATE checking */ /* make sure the state is at 0 */ l_is_valid &= (p_j2k->m_specific_param.m_decoder.m_state == J2K_STATE_NONE); @@ -7560,6 +7596,9 @@ static OPJ_BOOL opj_j2k_decoding_validation(opj_j2k_t *p_j2k, assert(p_stream != 00); assert(p_manager != 00); + OPJ_UNUSED(p_stream); + OPJ_UNUSED(p_manager); + /* STATE checking */ /* make sure the state is at 0 */ #ifdef TODO_MSD @@ -7813,6 +7852,8 @@ static OPJ_BOOL opj_j2k_copy_default_tcp_and_create_tcd(opj_j2k_t * p_j2k, assert(p_stream != 00); assert(p_manager != 00); + OPJ_UNUSED(p_stream); + l_image = p_j2k->m_private_image; l_nb_tiles = p_j2k->m_cp.th * p_j2k->m_cp.tw; l_tcp = p_j2k->m_cp.tcps; @@ -11442,6 +11483,9 @@ static OPJ_BOOL opj_j2k_end_encoding(opj_j2k_t *p_j2k, assert(p_manager != 00); assert(p_stream != 00); + OPJ_UNUSED(p_stream); + OPJ_UNUSED(p_manager); + opj_tcd_destroy(p_j2k->m_tcd); p_j2k->m_tcd = 00; @@ -11474,6 +11518,9 @@ static OPJ_BOOL opj_j2k_destroy_header_memory(opj_j2k_t * p_j2k, assert(p_stream != 00); assert(p_manager != 00); + OPJ_UNUSED(p_stream); + OPJ_UNUSED(p_manager); + if (p_j2k->m_specific_param.m_encoder.m_header_tile_data) { opj_free(p_j2k->m_specific_param.m_encoder.m_header_tile_data); p_j2k->m_specific_param.m_encoder.m_header_tile_data = 0; @@ -11496,6 +11543,8 @@ static OPJ_BOOL opj_j2k_init_info(opj_j2k_t *p_j2k, assert(p_stream != 00); (void)l_cstr_info; + OPJ_UNUSED(p_stream); + /* TODO mergeV2: check this part which use cstr_info */ /*l_cstr_info = p_j2k->cstr_info; @@ -11557,6 +11606,8 @@ static OPJ_BOOL opj_j2k_create_tcd(opj_j2k_t *p_j2k, assert(p_manager != 00); assert(p_stream != 00); + OPJ_UNUSED(p_stream); + p_j2k->m_tcd = opj_tcd_create(OPJ_FALSE); if (! p_j2k->m_tcd) { diff --git a/src/lib/openjp2/jp2.c b/src/lib/openjp2/jp2.c index 84dd5004..536cc50e 100644 --- a/src/lib/openjp2/jp2.c +++ b/src/lib/openjp2/jp2.c @@ -44,6 +44,8 @@ #define OPJ_BOX_SIZE 1024 +#define OPJ_UNUSED(x) (void)x + /** @name Local static functions */ /*@{*/ @@ -1818,6 +1820,8 @@ static OPJ_BOOL opj_jp2_write_jp(opj_jp2_t *jp2, assert(jp2 != 00); assert(p_manager != 00); + OPJ_UNUSED(jp2); + /* write box length */ opj_write_bytes(l_signature_data, 12, 4); /* writes box type */ @@ -2160,6 +2164,8 @@ static OPJ_BOOL opj_jp2_default_validation(opj_jp2_t * jp2, assert(cio != 00); assert(p_manager != 00); + OPJ_UNUSED(p_manager); + /* JPEG2000 codec validation */ /* STATE checking */ @@ -2826,6 +2832,9 @@ static OPJ_BOOL opj_jp2_setup_decoding_validation(opj_jp2_t *jp2, assert(jp2 != 00); assert(p_manager != 00); + OPJ_UNUSED(jp2); + OPJ_UNUSED(p_manager); + /* DEVELOPER CORNER, add your custom validation procedure */ return OPJ_TRUE; |
