Replaced magic numbers for string lenghts with sizeof. Corrected sizeof statements for keyboard_*; we shouldn't count the trailing zero.

git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@964 423420c4-83ab-492f-b58f-81f9feb106b5
This commit is contained in:
Peter Åstrand 2005-08-03 11:47:20 +00:00
parent 8882a06591
commit 87ca88dabb

View File

@ -314,23 +314,23 @@ xkeymap_read(char *mapname)
}
/* Include */
if (strncmp(line, "include ", 8) == 0)
if (strncmp(line, "include ", sizeof("include ") - 1) == 0)
{
if (!xkeymap_read(line + 8))
if (!xkeymap_read(line + sizeof("include ") - 1))
return False;
continue;
}
/* map */
if (strncmp(line, "map ", 4) == 0)
if (strncmp(line, "map ", sizeof("map ") - 1) == 0)
{
g_keylayout = strtol(line + 4, NULL, 16);
g_keylayout = strtol(line + sizeof("map ") - 1, NULL, 16);
DEBUG_KBD(("Keylayout 0x%x\n", g_keylayout));
continue;
}
/* compose */
if (strncmp(line, "enable_compose", 15) == 0)
if (strncmp(line, "enable_compose", sizeof("enable_compose") - 1) == 0)
{
DEBUG_KBD(("Enabling compose handling\n"));
g_enable_compose = True;
@ -338,33 +338,35 @@ xkeymap_read(char *mapname)
}
/* sequence */
if (strncmp(line, "sequence", 8) == 0)
if (strncmp(line, "sequence", sizeof("sequence") - 1) == 0)
{
add_sequence(line + 8, mapname);
add_sequence(line + sizeof("sequence") - 1, mapname);
continue;
}
/* keyboard_type */
if (strncmp(line, "keyboard_type ", sizeof("keyboard_type ")) == 0)
if (strncmp(line, "keyboard_type ", sizeof("keyboard_type ") - 1) == 0)
{
g_keyboard_type = strtol(line + sizeof("keyboard_type "), NULL, 16);
g_keyboard_type = strtol(line + sizeof("keyboard_type ") - 1, NULL, 16);
DEBUG_KBD(("keyboard_type 0x%x\n", g_keyboard_type));
continue;
}
/* keyboard_subtype */
if (strncmp(line, "keyboard_subtype ", sizeof("keyboard_subtype ")) == 0)
if (strncmp(line, "keyboard_subtype ", sizeof("keyboard_subtype ") - 1) == 0)
{
g_keyboard_subtype = strtol(line + sizeof("keyboard_subtype "), NULL, 16);
g_keyboard_subtype =
strtol(line + sizeof("keyboard_subtype ") - 1, NULL, 16);
DEBUG_KBD(("keyboard_subtype 0x%x\n", g_keyboard_subtype));
continue;
}
/* keyboard_functionkeys */
if (strncmp(line, "keyboard_functionkeys ", sizeof("keyboard_functionkeys ")) == 0)
if (strncmp(line, "keyboard_functionkeys ", sizeof("keyboard_functionkeys ") - 1) ==
0)
{
g_keyboard_functionkeys =
strtol(line + sizeof("keyboard_functionkeys "), NULL, 16);
strtol(line + sizeof("keyboard_functionkeys ") - 1, NULL, 16);
DEBUG_KBD(("keyboard_functionkeys 0x%x\n", g_keyboard_functionkeys));
continue;
}