mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-12-08 06:09:50 +00:00
avutil/common: cast GET_BYTE/GET_16BIT returned value
In case of GET_BYTE/GET_16BIT return signed value.
(cherry picked from commit 0ae8df5f2c)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
19bc0ef3f3
commit
87e1bea70b
1 changed files with 4 additions and 4 deletions
|
|
@ -486,13 +486,13 @@ static av_always_inline av_const int av_parity_c(uint32_t v)
|
|||
* to prevent undefined results.
|
||||
*/
|
||||
#define GET_UTF8(val, GET_BYTE, ERROR)\
|
||||
val= (GET_BYTE);\
|
||||
val= (uint8_t)(GET_BYTE);\
|
||||
{\
|
||||
uint32_t top = (val & 128) >> 1;\
|
||||
if ((val & 0xc0) == 0x80 || val >= 0xFE)\
|
||||
{ERROR}\
|
||||
while (val & top) {\
|
||||
unsigned int tmp = (GET_BYTE) - 128;\
|
||||
unsigned int tmp = (uint8_t)(GET_BYTE) - 128;\
|
||||
if(tmp>>6)\
|
||||
{ERROR}\
|
||||
val= (val<<6) + tmp;\
|
||||
|
|
@ -511,11 +511,11 @@ static av_always_inline av_const int av_parity_c(uint32_t v)
|
|||
* typically a goto statement.
|
||||
*/
|
||||
#define GET_UTF16(val, GET_16BIT, ERROR)\
|
||||
val = (GET_16BIT);\
|
||||
val = (uint16_t)(GET_16BIT);\
|
||||
{\
|
||||
unsigned int hi = val - 0xD800;\
|
||||
if (hi < 0x800) {\
|
||||
val = (GET_16BIT) - 0xDC00;\
|
||||
val = (uint16_t)(GET_16BIT) - 0xDC00;\
|
||||
if (val > 0x3FFU || hi > 0x3FFU)\
|
||||
{ERROR}\
|
||||
val += (hi<<10) + 0x10000;\
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue