Skip to content

Commit

Permalink
Try to make sure we have ssize_t defined
Browse files Browse the repository at this point in the history
  • Loading branch information
starseeker committed Dec 21, 2023
1 parent d46eff4 commit ad65879
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions lib/netpbm/pgm.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,32 @@ extern "C" {
} /* to fake out automatic code indenters */
#endif

/* Make sure we have ssize_t */
#if defined(_MSC_VER) && !defined(HAVE_SSIZE_T)
# ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
# endif
# include <limits.h>
# include <stddef.h>
typedef ptrdiff_t ssize_t;
# define HAVE_SSIZE_T 1
# ifndef SSIZE_MAX
# if defined(LONG_MAX)
# define SSIZE_MAX LONG_MAX
# elif defined(INT_MAX)
# define SSIZE_MAX INT_MAX
# elif defined(_POSIX_SSIZE_MAX)
# define SSIZE_MAX _POSIX_SSIZE_MAX
# else
/* Go with POSIX minimum acceptable value. This is smaller than
* we would like, but is a safe default value.
*/
# define SSIZE_MAX 32767
# endif
# endif
#endif


/* The following definition has nothing to do with the format of a PGM file */
typedef unsigned int gray;

Expand Down

0 comments on commit ad65879

Please sign in to comment.