Skip to content
Closed
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions main/streams/plain_wrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ extern int php_get_gid_by_name(const char *name, gid_t *gid);
#endif

#if defined(PHP_WIN32)
# define PLAIN_WRAP_BUF_SIZE(st) (((st) > UINT_MAX) ? UINT_MAX : (unsigned int)(st))
# define PLAIN_WRAP_BUF_SIZE(st) ((unsigned int)(st > INT_MAX ? INT_MAX : st))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch. I think it is possible to simplify line 356/360, what do you think ?

#define fsync _commit
#define fdatasync fsync
#else
Expand Down Expand Up @@ -354,7 +354,7 @@ static ssize_t php_stdiop_write(php_stream *stream, const char *buf, size_t coun

if (data->fd >= 0) {
#ifdef PHP_WIN32
ssize_t bytes_written = _write(data->fd, buf, (unsigned int)(count > INT_MAX ? INT_MAX : count));
ssize_t bytes_written = _write(data->fd, buf, PLAIN_WRAP_BUF_SIZE(count));
#else
ssize_t bytes_written = write(data->fd, buf, count);
#endif
Expand Down