mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-02-02 12:30:24 +08:00
Cygwin: file I/O: make sure to treat write return value as ssize_t
The return type of fhandler write methods is ssize_t. Don't use an int to store the return value, use ssize_t. Use ptrdiff_t for the buffer size. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
parent
2d04009839
commit
726ad38d42
@ -949,9 +949,9 @@ fhandler_base::write (const void *ptr, size_t len)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* We've got a buffer-full, or we're out of data. Write it out */
|
/* We've got a buffer-full, or we're out of data. Write it out */
|
||||||
int nbytes;
|
ssize_t nbytes;
|
||||||
int want = buf_ptr - buf;
|
ptrdiff_t want = buf_ptr - buf;
|
||||||
if ((nbytes = raw_write (buf, want)) == want)
|
if ((nbytes = raw_write (buf, (size_t) want)) == want)
|
||||||
{
|
{
|
||||||
/* Keep track of how much written not counting additional \r's */
|
/* Keep track of how much written not counting additional \r's */
|
||||||
res = data - (char *)ptr;
|
res = data - (char *)ptr;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user