cURL / Mailing Lists / curl-library / Single Mail

curl-library

libCurl 7.16.0, MSVC 6.0: datatype of curl_off_t raises warning C4244 in transfer.c(1147)

From: Stefan Krause <stefan.krause_at_gmx.net>
Date: Tue, 05 Dec 2006 20:12:49 +0100

Hi All,

I am compiling libcurl 7.16.0 with MSVC 6.0. I don't use the provided
Visual Studio Makefiles but my own ones based on Jam.
The compiler is required to treat warnings as errors, see the following
lines:

transfer.c(1147) : error C2220: warning treated as error - no object
file generated
transfer.c(1147) : warning C4244: 'function' : conversion from '__int64
' to 'unsigned int ', possible loss of data

Code-Snipped from transfer.c(1147):
   curl_off_t excess = k->bytecount + ((curl_off_t) nread) - k->maxdownload;
   .....
   Curl_read_rewind(conn, excess);

Curl_read_rewind is defines as follows in file sendf.h:
   void Curl_read_rewind(struct connectdata *conn, size_t extraBytesRead);

I use an unmodified version of config-win32.h and in curl\curl.h

curl_off_t is defined as
   typedef signed __int64 curl_off_t;

Is this a libcurl problem or do I have to make additional configuration
setting in my header files? What can I do to
work around the problem, I have to fix the warning, otherwise I cannot
compile the code.

But I think there is a general problem with the signature of
Curl_read_rewind. On 32-bit platforms size_t is of type 'unsigned
integer' and cannot hold the data from an '__int64'.

Thanks in advance!

Kind regards

Stefan

-------------------------------------
Compiler options for transfer.c

   PATH=C:\Programme\Microsoft Visual
Studio\VC98\Bin;C:\Programme\Microsoft Visual Studio\Common\MSDev98\Bin
   set CL= /IX:\libcurl_src\src\include /IX:\libcurl_src\src\private
/IX:\ /I"C:\Programme\Microsoft Visual Studio\VC98\include"
/I"C:\Programme\Microsoft Visual Studio\VC98\atl\include"
/I"C:\Programme\Microsoft Visual Studio\VC98\mfc\include"
   cl /nologo /c /FoX:\libcurl_src\src\private\transfer.obj
/FdX:\libcurl_src\src\private\transfer.pdb /Od /ZI /MTd /GZ /GX /W3 /WX
/Zm200 -DHTTP_ONLY -DCURL_STATICLIB /DWIN32 /D_MBCS /D_LIB /D_WIN32
/DPC=1 /TcX:\libcurl_src\src\private\transfer.c
Received on 2006-12-05