[1/4] cmd: Avoid checking handle type when already known in WCMD_ReadFile

Eric Pouech eric.pouech at orange.fr
Tue Oct 4 08:19:49 CDT 2011


Le 4 octobre 2011 13:40, Frédéric Delanoy <frederic.delanoy at gmail.com> a
écrit :

> 2011/10/4 Dan Kegel <dank at kegel.com>:
> > + * handle_type: type of hIn handle
> > + *              0 if file, 1 if console, anything else if unknown
> (autodetect)
> >
> > I suspect you want an enum for that.
>
> Well I thought about that, but found it a bit overkill for such a
> limited set of possible values.
> Also, if I used sthg like
>
> enum CMD_HANDLE_TYPE {
>   CMD_HT_FILE = 0,
>   CMD_HT_CONSOLE = 1,
>   CMD_HT_UNKNOWN = 2
> }
>
> again, this is not needed (passing all thoses CMD_HT bits)

static inline BOOL is_console_handle(HANDLE h) {return ((DWORD_PTR)h) & 3 ==
3;}
will test every handle and tell whether it's a console or a regular (file,
pipe...) handle

A+

> --
> --
> Eric Pouech
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20111004/cac31df7/attachment.html>


More information about the wine-devel mailing list