Commit 6239146e authored by Marc Hoersken's avatar Marc Hoersken
Browse files

warnless: add wrapper function for read and write on Windows

parent dc0f8c04
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -400,6 +400,20 @@ curl_socket_t curlx_sitosk(int i)

#endif /* USE_WINSOCK */

#if defined(WIN32) || defined(_WIN32)

ssize_t curlx_read(int fd, void *buf, size_t count)
{
  return (ssize_t)read(fd, buf, curlx_uztoui(count));
}

ssize_t curlx_write(int fd, const void *buf, size_t count)
{
  return (ssize_t)write(fd, buf, curlx_uztoui(count));
}

#endif /* WIN32 || _WIN32 */

#if defined(__INTEL_COMPILER) && defined(__unix__)

int curlx_FD_ISSET(int fd, fd_set *fdset)
+15 −0
Original line number Diff line number Diff line
@@ -60,6 +60,21 @@ curl_socket_t curlx_sitosk(int i);

#endif /* USE_WINSOCK */

#if defined(WIN32) || defined(_WIN32)

ssize_t curlx_read(int fd, void *buf, size_t count);

ssize_t curlx_write(int fd, const void *buf, size_t count);

#ifndef BUILDING_WARNLESS_C
#  undef  read
#  define read(fd, buf, count)  curlx_read(fd, buf, count)
#  undef  write
#  define write(fd, buf, count) curlx_write(fd, buf, count)
#endif

#endif /* WIN32 || _WIN32 */

#if defined(__INTEL_COMPILER) && defined(__unix__)

int curlx_FD_ISSET(int fd, fd_set *fdset);
+2 −1
Original line number Diff line number Diff line
@@ -13,7 +13,8 @@ CURLX_ONES = \
	../lib/strtoofft.c \
	../lib/strdup.c \
	../lib/rawstr.c \
	../lib/nonblock.c
	../lib/nonblock.c \
	../lib/warnless.c

CURL_CFILES = \
	tool_binmode.c \