cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: VC9 libcurl compiler warnings (64 bit only)

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Sat, 24 Jul 2010 22:58:11 +0200 (CEST)

On Fri, 23 Jul 2010, Adam Light wrote:

Thanks a lot for this. We should get these warnings fixed...

> connect.c(1084) : warning C4244: '=' : conversion from 'curl_socket_t'
> to 'long', possible loss of data
> This seems to be a problem because curl_socket_t is defined as UINT_PTR and
> UINT_PTR is defined, in x64, as: typedef unsigned __int64 UINT_PTR
>
> If param_longp is holding a pointer, which it appears to be doing, it needs
> to be large enough to actually hold the pointer.

param_longp is a 'long *' in that function. That is a pointer. It can point to
data. It points to a long.

A 'curl_socket_t' is typedef'ed to be a SOCKET type on Windows. Isn't that
still a 32bit variable? Are you saying that SOCKET is 64 bit type in 64 bit
Windows?

If so, then we even have an API/ABI problem.

> #2-4:
> curl_addrinfo.c(154) : warning C4267: '=' : conversion from 'size_t'
> to 'curl_socklen_t', possible loss of data

Does it help if we add a typecast (and a comment) ?

> file.c(556) : warning C4267: 'function' : conversion from 'size_t' to
> 'unsigned int', possible loss of data

Is your read() returning anything else but ssize_t ? If not, what exactly does
your ssize_t get typedef'ed to in the libcurl headers? If it does, what _does_
your read() return?

> http.c(1072) : warning C4244: '+=' : conversion from '__int64' to
> 'long', possible loss of data

I committed and a pushed a fix for this just now that simply typecasts the
added value to a long.

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2010-07-24