msvcrt: Implement _fcvt_s. (resend)

Alexandre Julliard julliard at winehq.org
Tue Dec 28 10:35:10 CST 2010


Eryk Wieliczko <ewdevel at gmail.com> writes:

> @@ -1127,9 +1127,9 @@ int CDECL _ecvt_s( char *buffer, MSVCRT_size_t length, double number, int ndigit
>      /* special case - inf */
>      if(number == HUGE_VAL || number == -HUGE_VAL)
>      {
> -        memset(buffer, '0', ndigits);
> +        memset(buffer, '0', max(ndigits, 0));
>          memcpy(buffer, infret, min(ndigits, sizeof(infret) - 1 ) );
> -        buffer[ndigits] = '\0';
> +        buffer[max(ndigits, 0)] = '\0';

You'd have to fix the memcpy too, though the whole thing doesn't make
much sense if ndigits is negative. Probably needs to be rethought, with
some test cases.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list