Cygwin: serial: read: revamp raw_read, change vmin_ and vtime_ to cc_t

- Datatypes were incorrect, especially vmin_ and vtime_.
  Change them to cc_t, as in user space.

- Error checking had a gap or two.  Debug output used the
  wrong formatting.

- Don't use ev member for ClearCommError and WaitCommEvent.
  Both returned values are different (error value vs. event
  code).  The values are not used elsewhere so it doesn't make
  sense to store them in the object.  Therefore, drop ev member.

- Some variable names were not very helpful.  Especially using
  n as lpNumberOfBytesTransferred from GetOverlappedResult and
  then actually printing it as if it makes sense was quite
  puzzeling.

- Rework the loop and the definition of minchars so that it
  still makes sense when looping.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
Corinna Vinschen
2020-03-17 17:45:05 +01:00
parent 9e106db0ad
commit 93b491c4f2
2 changed files with 121 additions and 98 deletions

View File

@ -1680,8 +1680,8 @@ class fhandler_cygdrive: public fhandler_disk_file
class fhandler_serial: public fhandler_base
{
private:
size_t vmin_; /* from termios */
unsigned int vtime_; /* from termios */
cc_t vmin_; /* from termios */
cc_t vtime_; /* from termios */
pid_t pgrp_;
int rts; /* for Windows 9x purposes only */
int dtr; /* for Windows 9x purposes only */
@ -1689,7 +1689,6 @@ class fhandler_serial: public fhandler_base
public:
int overlapped_armed;
OVERLAPPED io_status;
DWORD ev;
/* Constructor */
fhandler_serial ();