aboutsummaryrefslogtreecommitdiffstats
path: root/src/command.c
diff options
context:
space:
mode:
authorKalle Wallin <kaw@linux.se>2004-07-13 21:10:06 +0000
committerKalle Wallin <kaw@linux.se>2004-07-13 21:10:06 +0000
commit9a500d13055f16b70796a5fce5ec6de4a2844187 (patch)
tree8f57c14c8454ee836597cc47ed7eedd3b6f4dabe /src/command.c
parente9f21b11c862ad168bb5a850730861e01ad6f3d8 (diff)
downloadmpd-9a500d13055f16b70796a5fce5ec6de4a2844187.tar.gz
mpd-9a500d13055f16b70796a5fce5ec6de4a2844187.tar.xz
mpd-9a500d13055f16b70796a5fce5ec6de4a2844187.zip
Use glib's str functions (g_strlcat, g_strlcpy, g_snprintf, g_strdup_vprintf)
git-svn-id: https://svn.musicpd.org/ncmpc/trunk@1868 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src/command.c')
-rw-r--r--src/command.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/command.c b/src/command.c
index c256d0c5c..d38402b2c 100644
--- a/src/command.c
+++ b/src/command.c
@@ -233,17 +233,17 @@ key2str(int key)
for(i=0; i<=63; i++)
if( key==KEY_F(i) )
{
- snprintf(buf, 32, "F%d", i );
+ g_snprintf(buf, 32, "F%d", i );
return buf;
}
if( !(key & ~037) )
- snprintf(buf, 32, "Ctrl-%c", 'A'+(key & 037)-1 );
+ g_snprintf(buf, 32, "Ctrl-%c", 'A'+(key & 037)-1 );
else if( (key & ~037) == 224 )
- snprintf(buf, 32, "Alt-%c", 'A'+(key & 037)-1 );
+ g_snprintf(buf, 32, "Alt-%c", 'A'+(key & 037)-1 );
else if( key>32 && key<256 )
- snprintf(buf, 32, "%c", key);
+ g_snprintf(buf, 32, "%c", key);
else
- snprintf(buf, 32, "0x%03X", key);
+ g_snprintf(buf, 32, "0x%03X", key);
}
return buf;
}
@@ -293,14 +293,14 @@ get_key_names(command_t command, int all)
int j;
static char keystr[80];
- strncpy(keystr, key2str(cmds[i].keys[0]), 80);
+ g_strlcpy(keystr, key2str(cmds[i].keys[0]), sizeof(keystr));
if( !all )
return keystr;
j=1;
while( j<MAX_COMMAND_KEYS && cmds[i].keys[j]>0 )
{
- strcat(keystr, " ");
- strcat(keystr, key2str(cmds[i].keys[j]));
+ g_strlcat(keystr, " ", sizeof(keystr));
+ g_strlcat(keystr, key2str(cmds[i].keys[j]), sizeof(keystr));
j++;
}
return keystr;
@@ -477,14 +477,14 @@ check_key_bindings(command_definition_t *cp, char *buf, size_t bufsize)
{
if( buf )
#ifdef ENABLE_KEYDEF_SCREEN
- snprintf(buf, bufsize,
- _("Key %s assigned to %s and %s (press %s for the key editor)"),
- key2str(cp[i].keys[j]),
- get_key_command_name(cp[i].command),
- get_key_command_name(cmd),
- get_key_names(CMD_SCREEN_KEYDEF,0));
+ g_snprintf(buf, bufsize,
+ _("Key %s assigned to %s and %s (press %s for the key editor)"),
+ key2str(cp[i].keys[j]),
+ get_key_command_name(cp[i].command),
+ get_key_command_name(cmd),
+ get_key_names(CMD_SCREEN_KEYDEF,0));
#else
- snprintf(buf, bufsize,
+ g_snprintf(buf, bufsize,
_("Error: Key %s assigned to %s and %s !!!\n"),
key2str(cp[i].keys[j]),
get_key_command_name(cp[i].command),