In several places, code was using `int` as a drop-in replacement for `ssize_t`
on Windows where it does not exist. This is incorrect on some platforms. E.g. on
x86-64 this will result in `ssize_t` being a 32-bit type instead of a 64-bit
type. This change replaces it with the correct Windows equivalent, `SSIZE_T`.¹
¹ https://docs.microsoft.com/en-us/windows/win32/winprog/windows-data-types?redirectedfrom=MSDN#ssize_t
Gitlab: fixes #1804
### Fixed
+- **Breaking**: GVPR now typedefs `ssize_t` as `SSIZE_T` on Windows instead of
+ `int` #1804
- fix detection of unavailable output format
- SVG layout doesn't always respect requested size #1855
- mismatched format string in `mingle`
// Typedefs for missing types
#ifndef HAVE_SSIZE_T
+#ifdef _MSC_VER
+#include <BaseTsd.h>
+typedef SSIZE_T ssize_t;
+#else
typedef int ssize_t;
#endif
+#endif
// Libraries
#cmakedefine HAVE_ANN
#include "cgraph.h"
#ifdef _MSC_VER
-typedef int ssize_t;
+#include <BaseTsd.h>
+typedef SSIZE_T ssize_t;
#endif
/* Bits for flags variable in gvprstate_t.
/* Define to `int' if <sys/types.h> does not define. */
/* #undef pid_t */
-/* Define to `int' if <sys/types.h> does not define. */
-typedef int ssize_t;
+/* Define to `SSIZE_T' if <sys/types.h> does not define. */
+#include <BaseTsd.h>
+typedef SSIZE_T ssize_t;
#include <io.h>
#include <process.h> /* for getpid() and the exec..() family */
#include <direct.h> /* for _getcwd() and _chdir() */
+#include <BaseTsd.h>
#define srandom srand
#define random rand
#define lseek _lseek
/* read, write, and close are NOT being #defined here, because while there are file handle specific versions for Windows, they probably don't work for sockets. You need to look at your app and consider whether to call e.g. closesocket(). */
-#define ssize_t int
+#define ssize_t SSIZE_T
#define STDIN_FILENO 0
#define STDOUT_FILENO 1