diff options
author | wm4 <wm4@nowhere> | 2019-01-20 17:29:33 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2019-09-19 20:37:04 +0200 |
commit | 075111c4d2674dc7b9c4dbee9e23ed08d112e7ac (patch) | |
tree | cd0a7a6f3155546434507fa449f0656020688476 /sub/sd_lavc.c | |
parent | 5901c3ae0d11b52c290ebb785c1f6cf7256ae255 (diff) | |
download | mpv-075111c4d2674dc7b9c4dbee9e23ed08d112e7ac.tar.bz2 mpv-075111c4d2674dc7b9c4dbee9e23ed08d112e7ac.tar.xz |
sd_lavc: fix some obscure UB
UB-sanitizer complains that we shift bits into the sign (when a is
used). Change it to unsigned, which in theory is more correct and
silences the warning.
Doesn't matter in practice, both the "bug" and the fix have 0 impact.
Diffstat (limited to 'sub/sd_lavc.c')
-rw-r--r-- | sub/sd_lavc.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/sub/sd_lavc.c b/sub/sd_lavc.c index 71df4da36c..11f7711b7e 100644 --- a/sub/sd_lavc.c +++ b/sub/sd_lavc.c @@ -147,10 +147,10 @@ static void convert_pal(uint32_t *colors, size_t count, bool gray) { for (int n = 0; n < count; n++) { uint32_t c = colors[n]; - int b = c & 0xFF; - int g = (c >> 8) & 0xFF; - int r = (c >> 16) & 0xFF; - int a = (c >> 24) & 0xFF; + uint32_t b = c & 0xFF; + uint32_t g = (c >> 8) & 0xFF; + uint32_t r = (c >> 16) & 0xFF; + uint32_t a = (c >> 24) & 0xFF; if (gray) r = g = b = (r + g + b) / 3; // from straight to pre-multiplied alpha |