summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authormayeut <mayeut@users.noreply.github.com>2015-07-26 02:41:39 +0200
committermayeut <mayeut@users.noreply.github.com>2015-07-26 02:41:39 +0200
commitc423cc84e7be79051a7f9631fa26aa7d072361f2 (patch)
tree98d92f8501df77e5510c69eb4db6f1fab20b9855 /src/lib
parentd87de3a88da9a405a06e8d1e3b3d5d8b3e935ba2 (diff)
Remove some warnings when building
Update #442
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/openjp2/cio.c4
-rw-r--r--src/lib/openjp2/j2k.c13
-rw-r--r--src/lib/openjp2/opj_includes.h12
-rw-r--r--src/lib/openjp2/opj_intmath.h2
-rw-r--r--src/lib/openjp2/pi.c2
-rw-r--r--src/lib/openjp2/tcd.c2
6 files changed, 18 insertions, 17 deletions
diff --git a/src/lib/openjp2/cio.c b/src/lib/openjp2/cio.c
index c6f778c9..b2f6405f 100644
--- a/src/lib/openjp2/cio.c
+++ b/src/lib/openjp2/cio.c
@@ -302,7 +302,7 @@ OPJ_SIZE_T opj_stream_read_data (opj_stream_private_t * p_stream,OPJ_BYTE * p_bu
p_stream->m_current_data = p_stream->m_stored_data;
}
- while(1){
+ for (;;) {
/* we should read less than a chunk -> read a chunk */
if (p_size < p_stream->m_buffer_size) {
/* we should do an actual read on the media */
@@ -382,7 +382,7 @@ OPJ_SIZE_T opj_stream_write_data (opj_stream_private_t * p_stream,
return (OPJ_SIZE_T)-1;
}
- while(1) {
+ for (;;) {
l_remaining_bytes = p_stream->m_buffer_size - p_stream->m_bytes_in_buffer;
/* we have more memory than required */
diff --git a/src/lib/openjp2/j2k.c b/src/lib/openjp2/j2k.c
index 5a2e795e..bdc56959 100644
--- a/src/lib/openjp2/j2k.c
+++ b/src/lib/openjp2/j2k.c
@@ -5007,7 +5007,7 @@ static OPJ_BOOL opj_j2k_read_unk ( opj_j2k_t *p_j2k,
opj_event_msg(p_manager, EVT_WARNING, "Unknown marker\n");
- while(1) {
+ for (;;) {
/* Try to read 2 bytes (the next marker ID) from stream and copy them into the buffer*/
if (opj_stream_read_data(p_stream,p_j2k->m_specific_param.m_decoder.m_header_data,2,p_manager) != 2) {
opj_event_msg(p_manager, EVT_ERROR, "Stream too short\n");
@@ -7609,7 +7609,6 @@ static void opj_j2k_cp_destroy (opj_cp_t *p_cp)
{
OPJ_UINT32 l_nb_tiles;
opj_tcp_t * l_current_tile = 00;
- OPJ_UINT32 i;
if (p_cp == 00)
{
@@ -7617,10 +7616,11 @@ static void opj_j2k_cp_destroy (opj_cp_t *p_cp)
}
if (p_cp->tcps != 00)
{
+ OPJ_UINT32 i;
l_current_tile = p_cp->tcps;
l_nb_tiles = p_cp->th * p_cp->tw;
- for (i = 0; i < l_nb_tiles; ++i)
+ for (i = 0U; i < l_nb_tiles; ++i)
{
opj_j2k_tcp_destroy(l_current_tile);
++l_current_tile;
@@ -7763,7 +7763,6 @@ OPJ_BOOL opj_j2k_read_tile_header( opj_j2k_t * p_j2k,
OPJ_UINT32 l_marker_size;
const opj_dec_memory_marker_handler_t * l_marker_handler = 00;
opj_tcp_t * l_tcp = NULL;
- OPJ_UINT32 l_nb_tiles;
/* preconditions */
assert(p_stream != 00);
@@ -7975,8 +7974,8 @@ OPJ_BOOL opj_j2k_read_tile_header( opj_j2k_t * p_j2k,
/* FIXME DOC ???*/
if ( ! p_j2k->m_specific_param.m_decoder.m_can_decode) {
+ OPJ_UINT32 l_nb_tiles = p_j2k->m_cp.th * p_j2k->m_cp.tw;
l_tcp = p_j2k->m_cp.tcps + p_j2k->m_current_tile_number;
- l_nb_tiles = p_j2k->m_cp.th * p_j2k->m_cp.tw;
while( (p_j2k->m_current_tile_number < l_nb_tiles) && (l_tcp->m_data == 00) ) {
++p_j2k->m_current_tile_number;
@@ -9538,7 +9537,7 @@ static OPJ_BOOL opj_j2k_decode_tiles ( opj_j2k_t *p_j2k,
}
l_max_data_size = 1000;
- while (OPJ_TRUE) {
+ for (;;) {
if (! opj_j2k_read_tile_header( p_j2k,
&l_current_tile_no,
&l_data_size,
@@ -9661,7 +9660,7 @@ static OPJ_BOOL opj_j2k_decode_one_tile ( opj_j2k_t *p_j2k,
p_j2k->m_specific_param.m_decoder.m_state = J2K_STATE_TPHSOT;
}
- while (OPJ_TRUE) {
+ for (;;) {
if (! opj_j2k_read_tile_header( p_j2k,
&l_current_tile_no,
&l_data_size,
diff --git a/src/lib/openjp2/opj_includes.h b/src/lib/openjp2/opj_includes.h
index d8faede0..0d8c1ff3 100644
--- a/src/lib/openjp2/opj_includes.h
+++ b/src/lib/openjp2/opj_includes.h
@@ -123,7 +123,7 @@
/* MSVC before 2013 and Borland C do not have lrintf */
#if defined(_MSC_VER)
#include <intrin.h>
-static INLINE long lrintf(float f){
+static INLINE long opj_lrintf(float f){
#ifdef _M_X64
return _mm_cvt_ss2si(_mm_load_ss(&f));
@@ -139,10 +139,8 @@ static INLINE long lrintf(float f){
return i;
#endif
}
-#endif
-
-#if defined(__BORLANDC__)
-static INLINE long lrintf(float f) {
+#elif defined(__BORLANDC__)
+static INLINE long opj_lrintf(float f) {
#ifdef _M_X64
return (long)((f>0.0f) ? (f + 0.5f):(f -0.5f));
#else
@@ -156,6 +154,10 @@ static INLINE long lrintf(float f) {
return i;
#endif
}
+#else
+static INLINE long opj_lrintf(float f) {
+ return lrintf(f);
+}
#endif
diff --git a/src/lib/openjp2/opj_intmath.h b/src/lib/openjp2/opj_intmath.h
index 8fa89c03..188a09a7 100644
--- a/src/lib/openjp2/opj_intmath.h
+++ b/src/lib/openjp2/opj_intmath.h
@@ -87,7 +87,7 @@ static INLINE OPJ_UINT32 opj_uint_max(OPJ_UINT32 a, OPJ_UINT32 b) {
*/
static INLINE OPJ_UINT32 opj_uint_adds(OPJ_UINT32 a, OPJ_UINT32 b) {
OPJ_UINT64 sum = (OPJ_UINT64)a + (OPJ_UINT64)b;
- return -(OPJ_UINT32)(sum >> 32) | (OPJ_UINT32)sum;
+ return (OPJ_UINT32)(-(OPJ_INT32)(sum >> 32)) | (OPJ_UINT32)sum;
}
/**
diff --git a/src/lib/openjp2/pi.c b/src/lib/openjp2/pi.c
index e32aaeb0..1697bcbc 100644
--- a/src/lib/openjp2/pi.c
+++ b/src/lib/openjp2/pi.c
@@ -1430,7 +1430,7 @@ opj_pi_iterator_t *opj_pi_initialise_encode(const opj_image_t *p_image,
l_step_l = l_max_res * l_step_r;
/* set values for first packet iterator*/
- l_pi->tp_on = p_cp->m_specific_param.m_enc.m_tp_on;
+ l_pi->tp_on = (OPJ_BYTE)p_cp->m_specific_param.m_enc.m_tp_on;
l_current_pi = l_pi;
/* memory allocation for include*/
diff --git a/src/lib/openjp2/tcd.c b/src/lib/openjp2/tcd.c
index 1caa615f..08d97c78 100644
--- a/src/lib/openjp2/tcd.c
+++ b/src/lib/openjp2/tcd.c
@@ -1775,7 +1775,7 @@ static OPJ_BOOL opj_tcd_dc_level_shift_decode ( opj_tcd_t *p_tcd )
for (j=0;j<l_height;++j) {
for (i = 0; i < l_width; ++i) {
OPJ_FLOAT32 l_value = *((OPJ_FLOAT32 *) l_current_ptr);
- *l_current_ptr = opj_int_clamp((OPJ_INT32)lrintf(l_value) + l_tccp->m_dc_level_shift, l_min, l_max); ;
+ *l_current_ptr = opj_int_clamp((OPJ_INT32)opj_lrintf(l_value) + l_tccp->m_dc_level_shift, l_min, l_max); ;
++l_current_ptr;
}
l_current_ptr += l_stride;