13
0

Accommodate some changes to 'ssize_t' in VS2019

In more recent versions of MSVC, ssize_t equates to 'long' (for a 32-bit build) or '__int64' (for 64-bit)
This commit is contained in:
John Emmas 2021-05-11 14:06:25 +01:00
parent 166ac63924
commit 952416c596
2 changed files with 13 additions and 1 deletions

View File

@ -32,8 +32,11 @@
#include "midi++/parser.h"
#ifndef __INT_MAX__ // 'ssize_t' won't be defined yet
// (except in later versions of MSVC)
#if !defined (_MSC_VER) || (_MSC_VER < 1800)
typedef long ssize_t;
#endif
#endif
using namespace std;
using namespace MIDI;

View File

@ -154,11 +154,20 @@ typedef int (FAR PBDEXTN_APICALLTYPE *CYGINIT_API)(unsigned int);
#ifndef _SSIZE_T_
#define _SSIZE_T_
typedef long _ssize_t;
#ifdef SSIZE_T
typedef SSIZE_T _ssize_t;
#elif _MSC_VER < 1800
typedef long _ssize_t;
#else
#include <basetsd.h>
typedef LONG_PTR _ssize_t; // AFAICT - LONG_PTR is equivalent to 'long' in Win32 and '__int64' in Win64 !!
#endif
#ifndef _NO_OLDNAMES
typedef _ssize_t ssize_t;
#endif
#endif /* ! _SSIZE_T_ */
typedef unsigned int nfds_t;