cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: curl_off_t to long compiler warnings in visual studio 2010 x86

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Wed, 1 Jan 2014 22:18:19 +0100 (CET)

On Wed, 1 Jan 2014, Ray Satiro wrote:

> 2>..\..\curl\lib\file.c(542): warning C4244: 'function' : conversion from 'curl_off_t' to 'long', possible loss of data
>        lseek(fd, data->state.resume_from, SEEK_SET))
>
> 104>..\..\curl\src\tool_cb_see.c(82): warning C4244: 'function' : conversion from 'curl_off_t' to 'long', possible loss of data
> in tool_seek_cb():
>   if(LSEEK_ERROR == lseek(in->fd, offset, whence))
>
> with lseek as:
> long __cdecl lseek(int _FileHandle, long _Offset, int _Origin)

Yeps, I consider that an intersting collision with POSIX which says the
function prototype looks like this:

  off_t lseek(int fildes, off_t offset, int whence);

and...

> I used cmake to make the vs project files. USE_WIN32_LARGE_FILES is not
> defined, should it be?

Yes it should, or you won't be able to use >2GB files. lib/curl_setup.h does
some magic defines based on the existence of that define. As you can see, the
lseek() use is then changed to _lseeki64() which probably at least changes
that warning!

Unfortunately, the cmake build system for libcurl is lagging behind and if you
use it, you need to be aware and be prepared to handle the consequences.

> There is some workaround in src\tool_cb_see.c tool_seek_cb() for working
> with larger offsets but I don't see one in lib\file.c. Does curl come with
> large file support by default?

curl support large files on all systems that support it, as far as I know, but
it also builds and runs on several systems that don't support large files.

> Also the solution contains over 100 of Test lib<n> projects. Is there a
> simple way to run all the tests after they're built?

The test suite is very extensive but has never completely successfully been
made to run on Windows (unless during some specific circumstances).

-- 
  / daniel.haxx.se

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2014-01-01