[PATCH 2/2] winmm: Parse MCI colon notation as in T:MM:SS:F

Alexandre Julliard julliard at winehq.org
Mon Mar 14 10:06:34 CDT 2011


<Joerg-Cyril.Hoehle at t-systems.com> writes:

> @@ -975,18 +975,31 @@ static	WORD		MCI_GetMessage(LPCWSTR lpCmd)
>   */
>  static	BOOL		MCI_GetDWord(DWORD* data, LPWSTR* ptr)
>  {
> -    DWORD	val;
> -    LPWSTR	ret;
> +    DWORD	val, total = 0;
> +    LPWSTR	ret, src = *ptr;
> +    int		shift = 0;
>  
> -    val = strtoulW(*ptr, &ret, 10);
> +  colonized:
> +    val = strtoulW(src, &ret, 10);
> +    if (ret == src)	return FALSE;
>  
>      switch (*ret) {
>      case '\0':	break;
> +    case '\t':
>      case ' ':	ret++; break;
> +    case ':': {
> +	if ((val >= 256) || (shift >= 24))	return FALSE;
> +	total |= val << shift;
> +	shift += 8;
> +	src = ret + 1;
> +	goto colonized;
> +	}

Please use a proper loop, not a goto.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list