Cleanups (cppcheck)

This commit is contained in:
Dave Davenport 2016-03-02 18:07:59 +01:00
parent f05f0de583
commit f0b1998703
8 changed files with 26 additions and 25 deletions

View File

@ -38,15 +38,15 @@ typedef struct
typedef enum
{
TB_AUTOHEIGHT = 1 << 0,
TB_AUTOWIDTH = 1 << 1,
TB_LEFT = 1 << 16,
TB_RIGHT = 1 << 17,
TB_CENTER = 1 << 18,
TB_EDITABLE = 1 << 19,
TB_MARKUP = 1 << 20,
TB_WRAP = 1 << 21,
TB_PASSWORD = 1 << 22,
TB_AUTOHEIGHT = 1 << 0,
TB_AUTOWIDTH = 1 << 1,
TB_LEFT = 1 << 16,
TB_RIGHT = 1 << 17,
TB_CENTER = 1 << 18,
TB_EDITABLE = 1 << 19,
TB_MARKUP = 1 << 20,
TB_WRAP = 1 << 21,
TB_PASSWORD = 1 << 22,
} TextboxFlags;
typedef enum

View File

@ -129,7 +129,6 @@ Color color_get ( const char *const name );
void color_background ( cairo_t *d );
void color_border ( cairo_t *d );
void color_separator ( cairo_t *d );
void color_cache_reset ( void );
void x11_helper_set_cairo_rgba ( cairo_t *d, Color col );
/*@}*/

View File

@ -455,13 +455,13 @@ static void _window_mode_load_data ( Mode *sw, unsigned int cd )
if ( ( c = window_client ( w ) ) ) {
// final line format
unsigned int wmdesktop;
char desktop[5];
char desktop[5];
desktop[0] = 0;
size_t len =
size_t len =
( ( c->title != NULL ) ? strlen ( c->title ) : 0 ) + ( c->class ? strlen ( c->class ) : 0 ) + classfield + 50;
char *line = g_malloc ( len );
char *line = g_malloc ( len );
if ( !pd->config_i3_mode ) {
unsigned int wmdesktop = 0;
// find client's desktop.
xcb_get_property_cookie_t cookie;
xcb_get_property_reply_t *r;

View File

@ -579,7 +579,6 @@ int config_sanity_check ( void )
}
}
PangoFontDescription * pfd = NULL;
if ( config.menu_font ) {
PangoFontDescription *pfd = pango_font_description_from_string ( config.menu_font );
const char *fam = pango_font_description_get_family ( pfd );

View File

@ -139,7 +139,7 @@ void i3_support_free_internals ( void )
{
}
int i3_support_initialize ( void )
int i3_support_initialize ( G_GNUC_UNUSED xcb_stuff *xcb )
{
return FALSE;
}

View File

@ -65,7 +65,16 @@
// Pidfile.
char *pidfile = NULL;
const char *cache_dir = NULL;
struct xkb_stuff xkb = { NULL };
struct xkb_stuff xkb = {
.xcb_connection = NULL,
.context = NULL,
.keymap = NULL,
.state = NULL,
.compose = {
.table = NULL,
.state = NULL
}
};
char *config_path = NULL;
// Array of modi.
Mode **modi = NULL;
@ -378,7 +387,6 @@ static int add_mode ( const char * token )
else{
// Report error, don't continue.
fprintf ( stderr, "Invalid script switcher: %s\n", token );
token = NULL;
}
}
return ( index == num_modi ) ? -1 : (int) index;

View File

@ -496,7 +496,7 @@ static xcb_window_t __create_window ( MenuFlags menu_flags )
{ 0,
0,
XCB_EVENT_MASK_EXPOSURE | XCB_EVENT_MASK_BUTTON_PRESS | XCB_EVENT_MASK_BUTTON_RELEASE | XCB_EVENT_MASK_KEY_PRESS |
XCB_EVENT_MASK_KEY_RELEASE | XCB_EVENT_MASK_STRUCTURE_NOTIFY | XCB_EVENT_MASK_FOCUS_CHANGE | XCB_EVENT_MASK_BUTTON_1_MOTION, map };
XCB_EVENT_MASK_KEY_RELEASE | XCB_EVENT_MASK_STRUCTURE_NOTIFY | XCB_EVENT_MASK_FOCUS_CHANGE | XCB_EVENT_MASK_BUTTON_1_MOTION,map };
xcb_window_t box = xcb_generate_id ( xcb->connection );
xcb_create_window ( xcb->connection,

View File

@ -354,6 +354,7 @@ static unsigned int x11_find_mod_mask ( xkb_stuff *xkb, ... )
mask |= 1 << i;
}
}
va_end ( names );
return mask;
}
@ -613,12 +614,6 @@ static struct
unsigned int set;
} color_cache[3];
void color_cache_reset ( void )
{
color_cache[BACKGROUND].set = FALSE;
color_cache[BORDER].set = FALSE;
color_cache[SEPARATOR].set = FALSE;
}
void color_background ( cairo_t *d )
{
if ( !color_cache[BACKGROUND].set ) {