mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
Fix warning, read/write have unsigned int count on windows.
This commit is contained in:
parent
421f2605c0
commit
2408a05151
@ -195,4 +195,11 @@
|
||||
# define UV_BUF_LEN(x) (x)
|
||||
#endif
|
||||
|
||||
// Type of bufcnt for read/write on Windows is unsigned int, not size_t.
|
||||
#if defined(WIN32)
|
||||
# define IO_SIZE(x) (unsigned)(x)
|
||||
#else
|
||||
# define IO_SIZE(x) (x)
|
||||
#endif
|
||||
|
||||
#endif // NVIM_MACROS_H
|
||||
|
@ -461,7 +461,7 @@ ptrdiff_t os_read(const int fd, bool *ret_eof, char *const ret_buf,
|
||||
while (read_bytes != size) {
|
||||
assert(size >= read_bytes);
|
||||
const ptrdiff_t cur_read_bytes = read(fd, ret_buf + read_bytes,
|
||||
size - read_bytes);
|
||||
IO_SIZE(size - read_bytes));
|
||||
if (cur_read_bytes > 0) {
|
||||
read_bytes += (size_t)cur_read_bytes;
|
||||
}
|
||||
@ -564,7 +564,7 @@ ptrdiff_t os_write(const int fd, const char *const buf, const size_t size)
|
||||
while (written_bytes != size) {
|
||||
assert(size >= written_bytes);
|
||||
const ptrdiff_t cur_written_bytes = write(fd, buf + written_bytes,
|
||||
size - written_bytes);
|
||||
IO_SIZE(size - written_bytes));
|
||||
if (cur_written_bytes > 0) {
|
||||
written_bytes += (size_t)cur_written_bytes;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user