midimap: Avoid using isdigit() for WCHARs.

Found with Coccinelle.

Signed-off-by: Akihiro Sagawa <sagawa.aki@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Akihiro Sagawa 2017-05-17 00:00:10 +09:00 committed by Alexandre Julliard
parent 71e6152077
commit 2b0d9b5653
1 changed files with 3 additions and 2 deletions

View File

@ -116,14 +116,15 @@ static BOOL MIDIMAP_FindPort(const WCHAR* name, unsigned* dev)
return TRUE;
}
/* try the form #nnn */
if (*name == '#' && isdigit(name[1]))
if (*name == '#' && name[1] >= '0' && name[1] <= '9')
{
const WCHAR* ptr = name + 1;
*dev = 0;
do
{
*dev = *dev * 10 + *ptr - '0';
} while (isdigit(*++ptr));
ptr++;
} while (*ptr >= '0' && *ptr <= '9');
if (*dev < numMidiOutPorts)
return TRUE;
}