Index: core/fxcodec/codec/fx_codec_jpx_opj.cpp |
diff --git a/core/fxcodec/codec/fx_codec_jpx_opj.cpp b/core/fxcodec/codec/fx_codec_jpx_opj.cpp |
index aaa89388b806b8d7ba46d3cf076835b4aa7abc36..b45ee2b2090b8e1e4523e4b34d3d72ca33160fe5 100644 |
--- a/core/fxcodec/codec/fx_codec_jpx_opj.cpp |
+++ b/core/fxcodec/codec/fx_codec_jpx_opj.cpp |
@@ -29,11 +29,11 @@ OPJ_SIZE_T opj_read_from_memory(void* p_buffer, |
void* p_user_data) { |
DecodeData* srcData = static_cast<DecodeData*>(p_user_data); |
if (!srcData || !srcData->src_data || srcData->src_size == 0) { |
- return -1; |
+ return static_cast<OPJ_SIZE_T>(-1); |
dsinclair
2016/03/16 13:23:31
Can you add a TODO, this seems broken. OPJ_SIZE is
Wei Li
2016/03/16 17:51:31
Done.
Tom Sepez
2016/03/16 18:34:58
Probably ok along the lines of std::string::npos's
Wei Li
2016/03/17 02:24:05
Ack. I digged deeper and found that this is requir
Tom Sepez
2016/03/17 16:40:05
Acknowledged.
|
} |
// Reads at EOF return an error code. |
if (srcData->offset >= srcData->src_size) { |
- return -1; |
+ return static_cast<OPJ_SIZE_T>(-1); |
} |
OPJ_SIZE_T bufferLength = srcData->src_size - srcData->offset; |
OPJ_SIZE_T readlength = nb_bytes < bufferLength ? nb_bytes : bufferLength; |
@@ -46,11 +46,11 @@ OPJ_SIZE_T opj_write_from_memory(void* p_buffer, |
void* p_user_data) { |
DecodeData* srcData = static_cast<DecodeData*>(p_user_data); |
if (!srcData || !srcData->src_data || srcData->src_size == 0) { |
- return -1; |
+ return static_cast<OPJ_SIZE_T>(-1); |
} |
// Writes at EOF return an error code. |
if (srcData->offset >= srcData->src_size) { |
- return -1; |
+ return static_cast<OPJ_SIZE_T>(-1); |
} |
OPJ_SIZE_T bufferLength = srcData->src_size - srcData->offset; |
OPJ_SIZE_T writeLength = nb_bytes < bufferLength ? nb_bytes : bufferLength; |
@@ -61,14 +61,14 @@ OPJ_SIZE_T opj_write_from_memory(void* p_buffer, |
OPJ_OFF_T opj_skip_from_memory(OPJ_OFF_T nb_bytes, void* p_user_data) { |
DecodeData* srcData = static_cast<DecodeData*>(p_user_data); |
if (!srcData || !srcData->src_data || srcData->src_size == 0) { |
- return -1; |
+ return static_cast<OPJ_OFF_T>(-1); |
} |
// Offsets are signed and may indicate a negative skip. Do not support this |
// because of the strange return convention where either bytes skipped or |
// -1 is returned. Following that convention, a successful relative seek of |
// -1 bytes would be required to to give the same result as the error case. |
if (nb_bytes < 0) { |
- return -1; |
+ return static_cast<OPJ_OFF_T>(-1); |
} |
// FIXME: use std::make_unsigned<OPJ_OFF_T>::type once c++11 lib is OK'd. |
uint64_t unsignedNbBytes = static_cast<uint64_t>(nb_bytes); |