mirror of
https://github.com/awesomeWM/awesome
synced 2024-11-17 07:47:41 +01:00
length of static string s should be sizeof(s)-1
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
df57c34a06
commit
700ace5197
5 changed files with 10 additions and 10 deletions
|
@ -409,8 +409,8 @@ main(int argc, char **argv)
|
|||
|
||||
/* init default font and colors */
|
||||
globalconf.font = draw_font_new(globalconf.connection, globalconf.default_screen, "sans 8");
|
||||
xcolor_init(&globalconf.colors.fg, globalconf.connection, globalconf.default_screen, "black", sizeof("black"));
|
||||
xcolor_init(&globalconf.colors.bg, globalconf.connection, globalconf.default_screen, "white", sizeof("white"));
|
||||
xcolor_init(&globalconf.colors.fg, globalconf.connection, globalconf.default_screen, "black", sizeof("black")-1);
|
||||
xcolor_init(&globalconf.colors.bg, globalconf.connection, globalconf.default_screen, "white", sizeof("white")-1);
|
||||
|
||||
/* init cursors */
|
||||
globalconf.cursor[CurNormal] = xutil_cursor_new(globalconf.connection, CURSOR_LEFT_PTR);
|
||||
|
|
|
@ -58,7 +58,7 @@ socket_getaddr(const char *display)
|
|||
|
||||
/* a_strlen(display) because we strcat on display and
|
||||
* + 2 for / and \0 */
|
||||
path_len = a_strlen(homedir) + sizeof(CONTROL_UNIX_SOCKET_PATH)
|
||||
path_len = a_strlen(homedir) + sizeof(CONTROL_UNIX_SOCKET_PATH)-1
|
||||
+ (display_len ? (a_strlen(real_display)) : 1) + 2;
|
||||
|
||||
if(path_len >= ssizeof(addr->sun_path))
|
||||
|
|
|
@ -497,7 +497,7 @@ xutil_cursor_new(xcb_connection_t *conn, unsigned int cursor_font)
|
|||
|
||||
/* Get the font for the cursor*/
|
||||
font = xcb_generate_id(conn);
|
||||
xcb_open_font(conn, font, sizeof("cursor"), "cursor");
|
||||
xcb_open_font(conn, font, sizeof("cursor")-1, "cursor");
|
||||
|
||||
cursor = xcb_generate_id(conn);
|
||||
xcb_create_glyph_cursor(conn, cursor, font, font,
|
||||
|
|
10
lua.c
10
lua.c
|
@ -537,14 +537,14 @@ luaA_parserc(const char *confpatharg)
|
|||
|
||||
if(a_strlen(confdir))
|
||||
{
|
||||
len = a_strlen(confdir) + sizeof(AWESOME_CONFIG_FILE) + 1;
|
||||
len = a_strlen(confdir) + sizeof(AWESOME_CONFIG_FILE);
|
||||
confpath = p_new(char, len);
|
||||
a_strcpy(confpath, len, confdir);
|
||||
}
|
||||
else
|
||||
{
|
||||
confdir = getenv("HOME");
|
||||
len = a_strlen(confdir) + sizeof(AWESOME_CONFIG_FILE) + sizeof(XDG_CONFIG_HOME_DEFAULT) + 1;
|
||||
len = a_strlen(confdir) + sizeof(AWESOME_CONFIG_FILE)-1 + sizeof(XDG_CONFIG_HOME_DEFAULT);
|
||||
confpath = p_new(char, len);
|
||||
a_strcpy(confpath, len, confdir);
|
||||
a_strcat(confpath, len, XDG_CONFIG_HOME_DEFAULT);
|
||||
|
@ -561,7 +561,7 @@ luaA_parserc(const char *confpatharg)
|
|||
if(!(len = a_strlen(xdg_config_dirs)))
|
||||
{
|
||||
xdg_config_dirs = SYSCONFDIR;
|
||||
len = sizeof(SYSCONFDIR);
|
||||
len = sizeof(SYSCONFDIR)-1;
|
||||
}
|
||||
|
||||
xdg_files = a_strsplit(xdg_config_dirs, len, ':');
|
||||
|
@ -569,7 +569,7 @@ luaA_parserc(const char *confpatharg)
|
|||
for(buf = xdg_files; *buf; buf++)
|
||||
{
|
||||
p_delete(&confpath);
|
||||
len = a_strlen(*buf) + sizeof("AWESOME_CONFIG_FILE") + 1;
|
||||
len = a_strlen(*buf) + sizeof("AWESOME_CONFIG_FILE");
|
||||
confpath = p_new(char, len);
|
||||
a_strcpy(confpath, len, *buf);
|
||||
a_strcat(confpath, len, AWESOME_CONFIG_FILE);
|
||||
|
@ -587,7 +587,7 @@ luaA_parserc(const char *confpatharg)
|
|||
/* Assure there's at least one tag */
|
||||
for(screen = 0; screen < globalconf.screens_info->nscreen; screen++)
|
||||
if(!globalconf.screens[screen].tags.len)
|
||||
tag_append_to_screen(tag_new("default", sizeof("default"), layout_tile, 0.5, 1, 0), screen);
|
||||
tag_append_to_screen(tag_new("default", sizeof("default")-1, layout_tile, 0.5, 1, 0), screen);
|
||||
|
||||
p_delete(&confpath);
|
||||
}
|
||||
|
|
2
mouse.c
2
mouse.c
|
@ -276,7 +276,7 @@ mouse_infobox_new(int phys_screen, int border, area_t geometry,
|
|||
globalconf.default_screen,
|
||||
globalconf.font,
|
||||
MOUSE_INFOBOX_STRING_DEFAULT,
|
||||
sizeof(MOUSE_INFOBOX_STRING_DEFAULT),
|
||||
sizeof(MOUSE_INFOBOX_STRING_DEFAULT)-1,
|
||||
&pdata);
|
||||
geom.x = geometry.x + ((2 * border + geometry.width) - geom.width) / 2;
|
||||
geom.y = geometry.y + ((2 * border + geometry.height) - geom.height) / 2;
|
||||
|
|
Loading…
Reference in a new issue