1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2025-03-03 16:05:20 -05:00

Make cppcheck happy

This commit is contained in:
Dave Davenport 2016-03-05 20:07:25 +01:00
parent d99111c73b
commit 9978feb600
3 changed files with 65 additions and 68 deletions

View file

@ -1409,7 +1409,7 @@ static void rofi_view_mainloop_iter ( RofiViewState *state, xcb_generic_event_t
state->retv = MENU_OK;
}
}
else if ( strlen ( state->text->text ) > 0 ) {
else if ( state->text->text != NULL && strlen ( state->text->text ) > 0 ) {
state->retv = MENU_CUSTOM_INPUT;
}
else{

View file

@ -553,13 +553,10 @@ Color color_get ( const char *const name )
uint8_t g;
uint8_t r;
uint8_t a;
};
} sep;
uint32_t pixel;
} color = {
.r = 0xff,
.g = 0xff,
.b = 0xff,
.a = 0xff,
.pixel = 0xffffffff,
};
// Special format.
if ( strncmp ( cname, "argb:", 5 ) == 0 ) {
@ -571,14 +568,14 @@ Color color_get ( const char *const name )
switch ( length )
{
case 3:
color.a = 0xff;
color.r = 16 * ( ( val & 0xF00 ) >> 8 );
color.g = 16 * ( ( val & 0x0F0 ) >> 4 );
color.b = 16 * ( val & 0x00F );
color.sep.a = 0xff;
color.sep.r = 16 * ( ( val & 0xF00 ) >> 8 );
color.sep.g = 16 * ( ( val & 0x0F0 ) >> 4 );
color.sep.b = 16 * ( val & 0x00F );
break;
case 6:
color.pixel = val;
color.a = 0xff;
color.sep.a = 0xff;
break;
case 8:
color.pixel = val;
@ -592,20 +589,20 @@ Color color_get ( const char *const name )
map, strlen ( cname ), cname );
xcb_alloc_named_color_reply_t *r = xcb_alloc_named_color_reply ( xcb->connection, cc, NULL );
if ( r ) {
color.a = 0xFF;
color.r = r->visual_red;
color.g = r->visual_green;
color.b = r->visual_blue;
color.sep.a = 0xFF;
color.sep.r = r->visual_red;
color.sep.g = r->visual_green;
color.sep.b = r->visual_blue;
free ( r );
}
}
g_free ( copy );
Color ret = {
.red = color.r / 255.0,
.green = color.g / 255.0,
.blue = color.b / 255.0,
.alpha = color.a / 255.0,
.red = color.sep.r / 255.0,
.green = color.sep.g / 255.0,
.blue = color.sep.b / 255.0,
.alpha = color.sep.a / 255.0,
};
return ret;
}