forked from mirrors/i3
i3bar: fix clang compilation error by using const size_t (#6349)
Thanks to Shouη (@Shoun2137 on GitHub) for the suggestion.
This commit is contained in:
committed by
GitHub
parent
9dc5230000
commit
853b0d9161
@@ -1517,8 +1517,9 @@ static void init_tray(void) {
|
|||||||
/* request the tray manager atom for the X11 display we are running on */
|
/* request the tray manager atom for the X11 display we are running on */
|
||||||
/* The following line cannot use strlen as that makes compilation fail with
|
/* The following line cannot use strlen as that makes compilation fail with
|
||||||
* some versions of clang (-Wgnu-folding-constant): */
|
* some versions of clang (-Wgnu-folding-constant): */
|
||||||
char atomname[18 /* strlen("_NET_SYSTEM_TRAY_S") */ + 11];
|
const size_t systray_len = strlen("_NET_SYSTEM_TRAY_S") + 11;
|
||||||
snprintf(atomname, strlen("_NET_SYSTEM_TRAY_S") + 11, "_NET_SYSTEM_TRAY_S%d", screen);
|
char atomname[systray_len];
|
||||||
|
snprintf(atomname, systray_len, "_NET_SYSTEM_TRAY_S%d", screen);
|
||||||
xcb_intern_atom_cookie_t tray_cookie;
|
xcb_intern_atom_cookie_t tray_cookie;
|
||||||
if (tray_reply == NULL) {
|
if (tray_reply == NULL) {
|
||||||
tray_cookie = xcb_intern_atom(xcb_connection, 0, strlen(atomname), atomname);
|
tray_cookie = xcb_intern_atom(xcb_connection, 0, strlen(atomname), atomname);
|
||||||
|
|||||||
Reference in New Issue
Block a user