[FFmpeg-trac] #4466(avcodec:new): flashsv2enc warning while trying to take the absolute value of an unsigned int

FFmpeg trac at avcodec.org
Thu Apr 9 11:37:43 CEST 2015


#4466: flashsv2enc warning while trying to take the absolute value of an unsigned
int
---------------------------------------+---------------------------------
               Reporter:  jeremyhu     |                  Owner:
                   Type:  defect       |                 Status:  new
               Priority:  minor        |              Component:  avcodec
                Version:  unspecified  |               Keywords:
             Blocked By:               |               Blocking:
Reproduced by developer:  0            |  Analyzed by developer:  0
---------------------------------------+---------------------------------
 It looks like you might want to just cast to int to address this warning:

 {{{
 src/libavcodec/flashsv2enc.c:418:12: warning: taking the absolute value of
 unsigned type 'unsigned int' has no effect [-Wabsolute-value]
     return abs(t1 - t2) + abs((c1 & 0x000000ff) - (c2 & 0x000000ff)) +
            ^
 src/libavcodec/flashsv2enc.c:418:12: note: remove the call to 'abs' since
 unsigned values cannot be negative
     return abs(t1 - t2) + abs((c1 & 0x000000ff) - (c2 & 0x000000ff)) +
            ^~~
 src/libavcodec/flashsv2enc.c:418:27: warning: taking the absolute value of
 unsigned type 'unsigned int' has no effect [-Wabsolute-value]
     return abs(t1 - t2) + abs((c1 & 0x000000ff) - (c2 & 0x000000ff)) +
                           ^
 src/libavcodec/flashsv2enc.c:418:27: note: remove the call to 'abs' since
 unsigned values cannot be negative
     return abs(t1 - t2) + abs((c1 & 0x000000ff) - (c2 & 0x000000ff)) +
                           ^~~
 src/libavcodec/flashsv2enc.c:419:9: warning: taking the absolute value of
 unsigned type 'unsigned int' has no effect [-Wabsolute-value]
         abs(((c1 & 0x0000ff00) >> 8) - ((c2 & 0x0000ff00) >> 8)) +
         ^
 src/libavcodec/flashsv2enc.c:419:9: note: remove the call to 'abs' since
 unsigned values cannot be negative
         abs(((c1 & 0x0000ff00) >> 8) - ((c2 & 0x0000ff00) >> 8)) +
         ^~~
 src/libavcodec/flashsv2enc.c:420:9: warning: taking the absolute value of
 unsigned type 'unsigned int' has no effect [-Wabsolute-value]
         abs(((c1 & 0x00ff0000) >> 16) - ((c2 & 0x00ff0000) >> 16));
         ^
 src/libavcodec/flashsv2enc.c:420:9: note: remove the call to 'abs' since
 unsigned values cannot be negative
         abs(((c1 & 0x00ff0000) >> 16) - ((c2 & 0x00ff0000) >> 16));
         ^~~
 4 warnings generated.
 }}}

--
Ticket URL: <https://trac.ffmpeg.org/ticket/4466>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list