diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2004-07-14 13:51:17 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2004-07-14 13:51:17 +0000 |
commit | dd3a7a2042b705875e74e8aba78c075a8c87635c (patch) | |
tree | 6b9fdb3719a7d0435e24d0e0494e0ad348e18a3e /winsup/cygwin/fhandler_raw.cc | |
parent | e84b534998a19f38639d15ff62fa73265b2cb42f (diff) | |
download | newlib-dd3a7a2042b705875e74e8aba78c075a8c87635c.zip newlib-dd3a7a2042b705875e74e8aba78c075a8c87635c.tar.gz newlib-dd3a7a2042b705875e74e8aba78c075a8c87635c.tar.bz2 |
* fhandler_raw.cc (fhandler_dev_raw::raw_write): Remove buffered
write entirely.
Diffstat (limited to 'winsup/cygwin/fhandler_raw.cc')
-rw-r--r-- | winsup/cygwin/fhandler_raw.cc | 71 |
1 files changed, 1 insertions, 70 deletions
diff --git a/winsup/cygwin/fhandler_raw.cc b/winsup/cygwin/fhandler_raw.cc index edbae89..2de7f3d 100644 --- a/winsup/cygwin/fhandler_raw.cc +++ b/winsup/cygwin/fhandler_raw.cc @@ -310,10 +310,7 @@ int fhandler_dev_raw::raw_write (const void *ptr, size_t len) { DWORD bytes_written = 0; - DWORD bytes_to_write; - DWORD written; char *p = (char *) ptr; - char *tgt; int ret; /* Checking a previous end of media on tape */ @@ -327,73 +324,7 @@ fhandler_dev_raw::raw_write (const void *ptr, size_t len) devbufstart = devbufend = 0; is_writing (true); - if (devbuf) - { - while (len > 0) - { - if ((len < devbufsiz || devbufend > 0) && devbufend < devbufsiz) - { - bytes_to_write = min (len, devbufsiz - devbufend); - memcpy (devbuf + devbufend, p, bytes_to_write); - bytes_written += bytes_to_write; - devbufend += bytes_to_write; - p += bytes_to_write; - len -= bytes_to_write; - } - else - { - if (devbufend == devbufsiz) - { - bytes_to_write = devbufsiz; - tgt = devbuf; - } - else - { - bytes_to_write = (len / devbufsiz) * devbufsiz; - tgt = p; - } - - ret = 0; - write_file (tgt, bytes_to_write, &written, &ret); - - if (ret) - { - if (!is_eom (ret)) - { - __seterrno (); - return -1; - } - - eom_detected (true); - - if (!written && !bytes_written) - { - set_errno (ENOSPC); - return -1; - } - - if (tgt == p) - bytes_written += written; - - break; // from while (len > 0) - } - - if (tgt == devbuf) - { - if (written != devbufsiz) - memmove (devbuf, devbuf + written, devbufsiz - written); - devbufend = devbufsiz - written; - } - else - { - len -= written; - p += written; - bytes_written += written; - } - } - } - } - else if (len > 0) + if (len > 0) { if (!write_file (p, len, &bytes_written, &ret)) { |