[PATCH] compat: provide a declaration of ssize_t, for MS windows

Sean Farley sean at farley.io
Tue Jul 12 19:19:27 EDT 2016


Adrian Buehlmann <adrian at cadifra.com> writes:

> On 2016-07-12 19:16, Maciej Fijalkowski wrote:
>> # HG changeset patch
>> # User Maciej Fijalkowski <fijall at gmail.com>
>> # Date 1468238015 -7200
>> #      Mon Jul 11 13:53:35 2016 +0200
>> # Node ID 54968a2233db1823fa11f47dcc99395097bae3b4
>> # Parent  b40939504d0e01e3a7f067b8cf49f26718a7c27c
>> compat: provide a declaration of ssize_t, for MS windows
>> 
>> diff -r b40939504d0e -r 54968a2233db mercurial/compat.h
>> --- a/mercurial/compat.h	Mon Jul 11 11:05:08 2016 +0200
>> +++ b/mercurial/compat.h	Mon Jul 11 13:53:35 2016 +0200
>> @@ -5,6 +5,8 @@
>>  #ifdef _MSC_VER
>>  /* msvc 6.0 has problems */
>>  #define inline __inline
>> +#include <BaseTsd.h>
>> +typedef SSIZE_T ssize_t;
>>  typedef signed char int8_t;
>>  typedef short int16_t;
>>  typedef long int32_t;
>
> Perhaps, this can be simplified to:
>
> #if defined(_WIN64)
>  typedef __int64 ssize_t;
> #else
>  typedef long ssize_t;
> #endif
>
> (and thusly avoiding including BaseTsd.h ...)

I like this suggestion.


More information about the Mercurial-devel mailing list