summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-09-04 13:37:38 +0200
committerwm4 <wm4@nowhere>2013-09-04 13:37:38 +0200
commitdbff29c81d3127d69e97abcf7001f4b798898a81 (patch)
tree8bd8d977772a569d95fc4897e59de144d7bee306 /video
parent266ce242c34ac0836934317b7cccb8f7b82b4108 (diff)
downloadmpv-dbff29c81d3127d69e97abcf7001f4b798898a81.tar.bz2
mpv-dbff29c81d3127d69e97abcf7001f4b798898a81.tar.xz
x11_common: don't allocate more than needed for icon
icon_size is the number of array items of type long, not bytes. Change the type of icon_size to int, because size_t makes you think of byte quantities too quickly. As an unrelated change, change the (char *) cast to (unsigned char *), because it matches the common XChangeProperty idiom better.
Diffstat (limited to 'video')
-rw-r--r--video/out/x11_common.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/video/out/x11_common.c b/video/out/x11_common.c
index af83c6a53e..c8716d0a55 100644
--- a/video/out/x11_common.c
+++ b/video/out/x11_common.c
@@ -1029,9 +1029,9 @@ static void vo_x11_set_wm_icon(struct vo_x11_state *x11)
}
}
- size_t icon_size = 0;
+ int icon_size = 0;
for (int n = 0; n < num_icons; n++)
- icon_size += sizeof(long) * (2 + icon_w[n] * icon_h[n]);
+ icon_size += 2 + icon_w[n] * icon_h[n];
long *icon = talloc_array(NULL, long, icon_size);
long *cur = icon;
for (int n = 0; n < num_icons; n++) {
@@ -1043,7 +1043,8 @@ static void vo_x11_set_wm_icon(struct vo_x11_state *x11)
}
XChangeProperty(x11->display, x11->window, x11->XA_NET_WM_ICON,
- XA_CARDINAL, 32, PropModeReplace, (char *)icon, icon_size);
+ XA_CARDINAL, 32, PropModeReplace,
+ (unsigned char *)icon, icon_size);
talloc_free(icon);
talloc_free(uncompressed.start);
}