summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-05-10 10:38:05 +0200
committerwm4 <wm4@nowhere>2014-05-24 16:39:06 +0200
commitc9e6e7cc045f5ac8477b1c4dcfe34c12f0253397 (patch)
tree713db255ddbf96cc921fa0826317867cb7bf89bd
parentcb1d1e7a627a30f733a6d33fb42a96b0cb0c41d8 (diff)
downloadmpv-c9e6e7cc045f5ac8477b1c4dcfe34c12f0253397.tar.bz2
mpv-c9e6e7cc045f5ac8477b1c4dcfe34c12f0253397.tar.xz
sub: fix undefined behavior in ASS color calculation
This might shift bits into the sign, which is undefined behavior. Making the right operand unsigned was supposed to help with this, but it seems it did nothing, and C99 makes the result type dependent on the left operand only.
-rw-r--r--sub/ass_mp.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/sub/ass_mp.h b/sub/ass_mp.h
index 8fb9104662..86c5c7ff0a 100644
--- a/sub/ass_mp.h
+++ b/sub/ass_mp.h
@@ -31,7 +31,7 @@
#define MP_ASS_FONT_PLAYRESY 288
#define MP_ASS_RGBA(r, g, b, a) \
- (((r) << 24U) | ((g) << 16) | ((b) << 8) | (0xFF - (a)))
+ (((unsigned)(r) << 24) | ((g) << 16) | ((b) << 8) | (0xFF - (a)))
// m_color argument
#define MP_ASS_COLOR(c) MP_ASS_RGBA((c).r, (c).g, (c).b, (c).a)