From ff0843433a4597a55a31bad84f82886ce9943612 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Fri, 9 Apr 2004 20:39:19 +0000 Subject: * fhandler.h (class fhandler_dev_raw): Move status bits into protected bitfield struct type status_flags. Drop unused has_written bit. Add accessor methods. (fhandler_dev_raw::clear): Remove. (fhandler_dev_raw::reset_devbuf): Remove. * fhandler_floppy.cc (fhandler_dev_floppy::lseek): Use accessor method for is_writing. * fhandler_raw.cc: Use status accessor methods throughout. (fhandler_dev_raw::clear): Remove. (fhandler_dev_raw::fhandler_dev_raw): Drop clear call. (fhandler_dev_raw::~fhandler_dev_raw): Ditto. * fhandler_tape.cc: Use mtinfo::status accessor methods throughout. (mtinfo_drive::close): Fix conditional to enable BSD semantics correctly. (mtinfo_drive::get_status): Rename from mtinfo_drive::status. * mtinfo.h (class mtinfo_drive): Move status bits into private bitfield struct type status_flags. Add accessor methods. Rename status method to get_status. --- winsup/cygwin/fhandler.h | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) (limited to 'winsup/cygwin/fhandler.h') diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h index b889c8450..c3922b5a2 100644 --- a/winsup/cygwin/fhandler.h +++ b/winsup/cygwin/fhandler.h @@ -497,13 +497,27 @@ class fhandler_dev_raw: public fhandler_base size_t devbufsiz; size_t devbufstart; size_t devbufend; - int eom_detected : 1; - int eof_detected : 1; - int lastblk_to_read : 1; - int is_writing : 1; - int has_written : 1; + struct status_flags + { + unsigned eom_detected : 1; + unsigned eof_detected : 1; + unsigned lastblk_to_read : 1; + unsigned is_writing : 1; + public: + status_flags () : + eom_detected (0), eof_detected (0), lastblk_to_read (0), is_writing (0) + {} + } status; + + void eom_detected (bool b) { status.eom_detected = b; } + bool eom_detected () { return status.eom_detected; } + void eof_detected (bool b) { status.eof_detected = b; } + bool eof_detected () { return status.eof_detected; } + void lastblk_to_read (bool b) { status.lastblk_to_read = b; } + bool lastblk_to_read () { return status.lastblk_to_read; } + void is_writing (bool b) { status.is_writing = b; } + bool is_writing () { return status.is_writing; } - virtual void clear (void); virtual BOOL write_file (const void *buf, DWORD to_write, DWORD *written, int *err); virtual BOOL read_file (void *buf, DWORD to_read, DWORD *read, int *err); @@ -516,13 +530,6 @@ class fhandler_dev_raw: public fhandler_base fhandler_dev_raw (); - inline void reset_devbuf (void) - { - devbufstart = devbufend = 0; - eom_detected = eof_detected = 0; - lastblk_to_read = is_writing = has_written = 0; - } - public: ~fhandler_dev_raw (void); -- cgit v1.2.3