X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=lib%2Fwarnless.c;h=8c130d34c5e16af1089e95ac48a8f5911054c254;hb=ff9f0eb35d80c251e9a54162eae18f44349ae59d;hp=7a4b01eb6daba5f7cbb848af645c7fbbebd1cd9a;hpb=d69d98bb1e0435e6d0a6358677725bd663f598c0;p=platform%2Fupstream%2Fcurl.git diff --git a/lib/warnless.c b/lib/warnless.c index 7a4b01e..8c130d3 100644 --- a/lib/warnless.c +++ b/lib/warnless.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2013, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2014, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -175,6 +175,25 @@ int curlx_ultosi(unsigned long ulnum) } /* +** unsigned size_t to signed curl_off_t +*/ + +curl_off_t curlx_uztoso(size_t uznum) +{ +#ifdef __INTEL_COMPILER +# pragma warning(push) +# pragma warning(disable:810) /* conversion may lose significant bits */ +#endif + + DEBUGASSERT(uznum <= (size_t) CURL_MASK_SCOFFT); + return (curl_off_t)(uznum & (size_t) CURL_MASK_SCOFFT); + +#ifdef __INTEL_COMPILER +# pragma warning(pop) +#endif +} + +/* ** unsigned size_t to signed int */ @@ -400,6 +419,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)