cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Bug report: curl win32 ftruncate64 not working correctly.

From: Alessandro Vesely <vesely_at_tana.it>
Date: Fri, 14 Dec 2007 10:12:38 +0100

Daniel Stenberg wrote:
> On Thu, 13 Dec 2007, gdb007 wrote:
>> _chsize_s should work as a replacement for ftruncate64 in win32, it
>> use 64-bit integer as the file size, and therefore can handle file
>> sizes greater than 4 GB. you may view
>> http://msdn2.microsoft.com/en-us/library/whx354w1(VS.80).aspx for
>> function details.
>
> That page says it is "specific to Microsoft Visual Studio 2005/.NET
> Framework 2.0". If I click on the link for "Microsoft Visual Studio
> 2003/.NET Framework 1.1" (long names indeed) it says _chsize() only and
> that one just takes a long.
>
> Does this mean that _chsize_s() somehow only works with VS2005 or later?

"_s" is for security :-O

Compiling with Microsoft Visual C++ 2005 Express Edition I've been
surprised to learn that

   warning C4996: 'fopen' was declared deprecated

As it is not obvious how to suppress such spurious warnings, a
programmer may be tempted to use fopen_s, thus trading standard
compliance and portability for an unspecified sense of security.
It is an attempt to lock programmers into using MS products.

AFAICS, recent versions of MSVC sport their unique redistributable
CRT library. There is a _system's CRT_, which is the one that came
with that MSVC version 6 coauthored by PJ Plauger, IIRC. It is not
clean to target that library unless the compiler that doesn't
explicitly support it. MinGW's gcc, for one, does.
Received on 2007-12-14