Skip to content

Commit

Permalink
Merge pull request #5616 from mimaki/refine-ssize_t-on-msvc
Browse files Browse the repository at this point in the history
Fix build error and refine definition of `ssize_t` on MSVC.
  • Loading branch information
matz committed Dec 29, 2021
2 parents 6f5c211 + 1f3a385 commit 83f2e75
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
5 changes: 5 additions & 0 deletions include/mruby/common.h
Expand Up @@ -28,6 +28,11 @@
# define MRB_END_DECL
#endif

#if defined _MSC_VER
#include <BaseTsd.h>
typedef SSIZE_T ssize_t;
#endif

/**
* Shared compiler macros
*/
Expand Down
6 changes: 0 additions & 6 deletions mrbgems/mruby-io/src/io.c
Expand Up @@ -34,12 +34,6 @@
typedef long fsuseconds_t;
typedef int fmode_t;
typedef int mrb_io_read_write_size;
#ifndef MRB_MINGW32_LEGACY
#if !defined(_SSIZE_T_) && !defined(_SSIZE_T_DEFINED) && \
!defined(__have_typedef_ssize_t)
typedef SSIZE_T ssize_t;
#endif
#endif

#ifndef O_TMPFILE
#define O_TMPFILE O_TEMPORARY
Expand Down
3 changes: 0 additions & 3 deletions mrbgems/mruby-socket/src/socket.c
Expand Up @@ -13,9 +13,6 @@
#include <winerror.h>

#define SHUT_RDWR SD_BOTH
#ifndef _SSIZE_T_DEFINED
typedef int ssize_t;
#endif
typedef int fsize_t;
#else
#include <sys/types.h>
Expand Down

0 comments on commit 83f2e75

Please sign in to comment.