[prev in list] [next in list] [prev in thread] [next in thread] 

List:       wine-devel
Subject:    Re: [PATCH] winecfg: Add trackbar to set screen resolution in
From:       "Nigel Liang" <ncliang () gmail ! com>
Date:       2007-07-30 18:17:08
Message-ID: c023d6990707301117i70014a45hb2ebcd00875c895f () mail ! gmail ! com
[Download RAW message or body]

On 7/30/07, Alexandre Julliard <julliard@winehq.org> wrote:
> Nigel Liang <ncliang@gmail.com> writes:
>
> > +/* Utility functions to convert between WCHAR and long */
> > +long wcstolong(WCHAR * wcs)
> > +{
> > +    int i;
> > +    long lRet = 0;
> > +    BOOL bNeg = FALSE;
> > +
> > +    for (i = 0; wcs[i] != '\0'; i++) {
> > +        if (i == 0 && wcs[i] == '-') {
> > +            bNeg = TRUE;
> > +            continue;
> > +        }
> > +
> > +        lRet = lRet * 10 + (wcs[i] - '0');
> > +    }
> > +    return (bNeg ? -lRet : lRet);
> > +}
> > +
> > +WCHAR *longtow(long num, WCHAR *wcs)
> > +{
> > +    static const WCHAR str[] = { '%', 'l', 'd', 0 };
> > +    wsprintfW(wcs, str, num);
> > +    return wcs;
> > +}
>
> That's ugly. You should avoid using long if not really necessary,
> since it doesn't have the same size in MSVC. You shouldn't name a
> function wcs something since that's what wchar_t functions use. In any
> case we already have atoiW for that purpose. Also I don't think
> wrapping wsprintf is needed.
>
> --
> Alexandre Julliard
> julliard@winehq.org
>
Yeah, I did not like those either. The reason that I used them is
because trying to use the _ltow and wcstol functions from
msvcrt/stdlib.h caused a bunch of conflicting type errors. I'll get
rid of them....

-Nigel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic