Fix clang-tidy warnings.

This commit is contained in:
QC 2015-05-14 19:39:30 +02:00
parent 22f35983c0
commit 652a6ed7d2
3 changed files with 13 additions and 11 deletions

View File

@ -131,11 +131,11 @@ static const char *get_display_data ( unsigned int index, void *data, G_GNUC_UNU
* @param format The format string used. See below for possible syntax.
* @param string The selected entry.
* @param selected_line The selected line index.
*
*
* Function that outputs the selected line in the user-specified format.
* Currently the following formats are supported:
* * i: Print the index (0-(N-1))
* * d: Print the index (1-N)
* * d: Print the index (1-N)
* * s: Print input string.
* * e: Print input string shell quoted.
*
@ -149,7 +149,7 @@ static void dmenu_output_formatted_line ( const char *format, const char *string
fprintf ( stdout, "%d", selected_line );
}
else if ( format[i] == 'd' ) {
fprintf ( stdout, "%d", (selected_line+1) );
fprintf ( stdout, "%d", ( selected_line + 1 ) );
}
else if ( format[i] == 's' ) {
fputs ( string, stdout );
@ -182,11 +182,11 @@ int dmenu_switcher_dialog ( char **input )
int restart = FALSE;
// By default we print the unescaped line back.
char *format = "s";
char *format = "s";
// This is here for compatibility reason.
// Use -format 'i' instead.
// Use -format 'i' instead.
if ( find_arg ( "-i" ) >= 0 ) {
format = "i";
format = "i";
}
// Allow user to override the output format.
find_arg_str ( "-format", &format );

View File

@ -66,7 +66,7 @@ void i3_support_focus_window ( Window id )
}
remote.sun_family = AF_UNIX;
strcpy ( remote.sun_path, i3_socket_path );
g_strlcpy ( remote.sun_path, i3_socket_path, strlen ( i3_socket_path ) );
len = strlen ( remote.sun_path ) + sizeof ( remote.sun_family );
if ( connect ( s, ( struct sockaddr * ) &remote, len ) == -1 ) {

View File

@ -96,17 +96,19 @@ char* window_get_text_prop ( Display *display, Window w, Atom atom )
if ( XGetTextProperty ( display, w, &prop, atom ) && prop.value && prop.nitems ) {
if ( prop.encoding == XA_STRING ) {
res = g_malloc ( strlen ( ( char * ) prop.value ) + 1 );
size_t l = strlen ( ( char *) prop.value ) + 1;
res = g_malloc ( l );
// make clang-check happy.
if ( res ) {
strcpy ( res, ( char * ) prop.value );
g_strlcpy ( res, ( char * ) prop.value, l );
}
}
else if ( Xutf8TextPropertyToTextList ( display, &prop, &list, &count ) >= Success && count > 0 && *list ) {
res = g_malloc ( strlen ( *list ) + 1 );
size_t l = strlen ( *list ) + 1;
res = g_malloc ( l );
// make clang-check happy.
if ( res ) {
strcpy ( res, *list );
g_strlcpy ( res, *list, l );
}
XFreeStringList ( list );
}