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

Frédéric Delanoy frederic.delanoy at gmail.com
Tue Oct 4 06:40:52 CDT 2011


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
}

, I'd have to add error checking for unknown parameters passed to
WCMD_ReadFile, or never check for CMD_HT_UNKNOWN, and just use it as
default value.
So TBH I don't think an enum is really necessary (especially since
it's just a corner case; all "similar" functions use a BOOL
is_console_handle, covering cases 0 and 1. I wouldn't want to change
those)



More information about the wine-devel mailing list