Browse Source

v4l2: avoid shifting left a signed number by 31 bit

cppcheck warns about it with the following diagnostics:

    error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is
    undefined behaviour

* v4l2.c [!v4l2_fourcc_be] (v4l2_fourcc_be): Shift left 1U and not 1 in
order to get 0x80000000.
Eugene Syromyatnikov 2 months ago
parent
commit
91281fec78
1 changed files with 1 additions and 1 deletions
  1. 1
    1
      v4l2.c

+ 1
- 1
v4l2.c View File

@@ -47,7 +47,7 @@ typedef struct v4l2_standard struct_v4l2_standard;
47 47
 
48 48
 /* v4l2_fourcc_be was added by Linux commit v3.18-rc1~101^2^2~127 */
49 49
 #ifndef v4l2_fourcc_be
50
-# define v4l2_fourcc_be(a, b, c, d) (v4l2_fourcc(a, b, c, d) | (1 << 31))
50
+# define v4l2_fourcc_be(a, b, c, d) (v4l2_fourcc(a, b, c, d) | (1U << 31))
51 51
 #endif
52 52
 
53 53
 #define FMT_FRACT "%u/%u"

Loading…
Cancel
Save