Correct the wrong output management of opj_stream_read_seek function (thanks to EvenR)
authorMickael Savinaud <savmickael@users.noreply.github.com>
Thu, 16 Aug 2012 09:13:58 +0000 (09:13 +0000)
committerMickael Savinaud <savmickael@users.noreply.github.com>
Thu, 16 Aug 2012 09:13:58 +0000 (09:13 +0000)
libopenjpeg/cio.c
libopenjpeg/cio.h
libopenjpeg/j2k.c

index 1e9cdebd30f365a97cb00382c05bf1f3a3f9cc99..21ef55a977850f9b9a8704cfdf0673cf5272715f 100644 (file)
@@ -880,7 +880,7 @@ OPJ_OFF_T opj_stream_skip (opj_stream_private_t * p_stream, OPJ_OFF_T p_size, op
  * @param              p_stream        the stream to skip data from.
  * @param              p_size          the number of bytes to skip.
  * @param              p_event_mgr     the user event manager to be notified of special events.
- * @return             the number of bytes skipped, or -1 if an error occured.
+ * @return             OPJ_TRUE if success, or OPJ_FALSE if an error occured.
  */
 opj_bool opj_stream_read_seek (opj_stream_private_t * p_stream, OPJ_OFF_T p_size, opj_event_mgr_t * p_event_mgr)
 {
index 1c59e030e86808f074229c5943d4d23e9356b804..f5c4a86290ca8f7cfc20f573d2548f7724100360 100644 (file)
@@ -371,7 +371,7 @@ OPJ_OFF_T opj_stream_read_skip (opj_stream_private_t * p_stream, OPJ_OFF_T p_siz
  * @param              p_stream        the stream to skip data from.
  * @param              p_size          the number of bytes to skip.
  * @param              p_event_mgr     the user event manager to be notified of special events.
- * @return             the number of bytes skipped, or -1 if an error occured.
+ * @return             OPJ_TRUE if success, or OPJ_FALSE if an error occured.
  */
 opj_bool opj_stream_read_seek (opj_stream_private_t * p_stream, OPJ_OFF_T p_size, struct opj_event_mgr * p_event_mgr);
 
index 9627532528c44d3bf1e29453083c3ec60fba7786..043a46595ab0e0a2a72c0087ce68d8f070c307a9 100644 (file)
@@ -10571,13 +10571,13 @@ static opj_bool opj_j2k_decode_one_tile (     opj_j2k_v2_t *p_j2k,
                        if ( ! p_j2k->cstr_index->tile_index[l_tile_no_to_dec].nb_tps) {
                                /* the index for this tile has not been built,
                                 *  so move to the last SOT read */
-                               if ( opj_stream_read_seek(p_stream, p_j2k->m_specific_param.m_decoder.m_last_sot_read_pos+2, p_manager) ){
+                               if ( !(opj_stream_read_seek(p_stream, p_j2k->m_specific_param.m_decoder.m_last_sot_read_pos+2, p_manager)) ){
                                        opj_event_msg_v2(p_manager, EVT_ERROR, "Problem with seek function\n");
                                        return OPJ_FALSE;
                                }
                        }
                        else{
-                               if (opj_stream_read_seek(p_stream, p_j2k->cstr_index->tile_index[l_tile_no_to_dec].tp_index[0].start_pos+2, p_manager)) {
+                               if ( !(opj_stream_read_seek(p_stream, p_j2k->cstr_index->tile_index[l_tile_no_to_dec].tp_index[0].start_pos+2, p_manager)) ) {
                                        opj_event_msg_v2(p_manager, EVT_ERROR, "Problem with seek function\n");
                                        return OPJ_FALSE;
                                }