2121
2222#undef __STRICT_ANSI__
2323
24- /* Visual C++ 2013 (12 .0):
25- * - _MSC_VER: 1800
26- * - MSVCRT_VERSION: 120
24+ /* Visual C++ 2015 (14 .0):
25+ * - _MSC_VER: 1900
26+ * - MSVCRT_VERSION: 140
2727 */
2828#include "ruby/ruby.h"
2929#include "ruby/encoding.h"
@@ -113,10 +113,8 @@ static char *w32_getenv(const char *name, UINT cp);
113113#undef dup2
114114#undef strdup
115115
116- #if RUBY_MSVCRT_VERSION >= 140
117- # define _filbuf _fgetc_nolock
118- # define _flsbuf _fputc_nolock
119- #endif
116+ #define _filbuf _fgetc_nolock
117+ #define _flsbuf _fputc_nolock
120118#define enough_to_get (n ) (--(n) >= 0)
121119#define enough_to_put (n ) (--(n) >= 0)
122120
@@ -2401,7 +2399,6 @@ rb_w32_closedir(DIR *dirp)
24012399 return 0 ;
24022400}
24032401
2404- #if RUBY_MSVCRT_VERSION >= 140
24052402typedef struct {
24062403 union
24072404 {
@@ -2421,14 +2418,8 @@ typedef struct {
24212418#define FILE_COUNT (stream ) ((vcruntime_file*)stream)->_cnt
24222419#define FILE_READPTR (stream ) ((vcruntime_file*)stream)->_ptr
24232420#define FILE_FILENO (stream ) ((vcruntime_file*)stream)->_file
2424- #else
2425- #define FILE_COUNT (stream ) stream->_cnt
2426- #define FILE_READPTR (stream ) stream->_ptr
2427- #define FILE_FILENO (stream ) stream->_file
2428- #endif
24292421
24302422/* License: Ruby's */
2431- #if RUBY_MSVCRT_VERSION >= 140
24322423typedef char lowio_text_mode ;
24332424typedef char lowio_pipe_lookahead [3 ];
24342425
@@ -2445,30 +2436,14 @@ typedef struct {
24452436 uint8_t dbcsBufferUsed : 1 ; // Is the dbcsBuffer in use?
24462437 char dbcsBuffer ; // Buffer for the lead byte of DBCS when converting from DBCS to Unicode
24472438} ioinfo ;
2448- #else
2449- typedef struct {
2450- intptr_t osfhnd ; /* underlying OS file HANDLE */
2451- char osfile ; /* attributes of file (e.g., open in text mode?) */
2452- char pipech ; /* one char buffer for handles opened on pipes */
2453- int lockinitflag ;
2454- CRITICAL_SECTION lock ;
2455- char textmode ;
2456- char pipech2 [2 ];
2457- } ioinfo ;
2458- #endif
24592439
24602440#if !defined _CRTIMP || defined __MINGW32__
24612441#undef _CRTIMP
24622442#define _CRTIMP __declspec(dllimport)
24632443#endif
24642444
2465- #if RUBY_MSVCRT_VERSION >= 140
24662445static ioinfo * * __pioinfo = NULL ;
24672446#define IOINFO_L2E 6
2468- #else
2469- EXTERN_C _CRTIMP ioinfo * __pioinfo [];
2470- #define IOINFO_L2E 5
2471- #endif
24722447static inline ioinfo * _pioinfo (int );
24732448
24742449
@@ -2484,13 +2459,12 @@ static size_t pioinfo_extra = 0; /* workaround for VC++8 SP1 */
24842459static void
24852460set_pioinfo_extra (void )
24862461{
2487- #if RUBY_MSVCRT_VERSION >= 140
2488- # define FUNCTION_RET 0xc3 /* ret */
2489- # ifdef _DEBUG
2490- # define UCRTBASE "ucrtbased.dll"
2491- # else
2492- # define UCRTBASE "ucrtbase.dll"
2493- # endif
2462+ #define FUNCTION_RET 0xc3 /* ret */
2463+ #ifdef _DEBUG
2464+ # define UCRTBASE "ucrtbased.dll"
2465+ #else
2466+ # define UCRTBASE "ucrtbase.dll"
2467+ #endif
24942468 /* get __pioinfo addr with _isatty */
24952469 /*
24962470 * Why Ruby depends to _pioinfo is
@@ -2625,7 +2599,6 @@ set_pioinfo_extra(void)
26252599 __pioinfo = * (ioinfo * * * )(p );
26262600#endif
26272601#endif /* _M_ARM64 */
2628- #endif /* RUBY_MSVCRT_VERSION */
26292602 int fd ;
26302603
26312604 fd = _open ("NUL" , O_RDONLY );
0 commit comments