Bug #11482 » vs2015.patch
| time.c | ||
|---|---|---|
| 
                 else 
   | 
||
| 
                     *zone = zone_str("(NO-TIMEZONE-ABBREVIATION)"); 
   | 
||
| 
     #elif defined(HAVE_TZNAME) && defined(HAVE_DAYLIGHT) 
   | 
||
| 
     #ifdef _WIN32 
   | 
||
| 
     #define tzname _tzname 
   | 
||
| 
     #define daylight _daylight 
   | 
||
| 
     #endif 
   | 
||
| 
                 /* this needs tzset or localtime, instead of localtime_r */ 
   | 
||
| 
                 *zone = zone_str(tzname[daylight && tm.tm_isdst]); 
   | 
||
| 
     #else 
   | 
||
| win32/Makefile.sub | ||
|---|---|---|
| 
     !if $(MSC_VER) < 1400 
   | 
||
| 
     OPTFLAGS = -O2b2xg- 
   | 
||
| 
     !else 
   | 
||
| 
     OPTFLAGS = -O2sy- 
   | 
||
| 
     #OPTFLAGS = -O2sy- 
   | 
||
| 
     OPTFLAGS = -Od 
   | 
||
| 
     !endif 
   | 
||
| 
     !endif 
   | 
||
| 
     !if !defined(PLATFORM) 
   | 
||
| ... | ... | |
| 
     #define HAVE_STRUCT_STAT_ST_RDEV 1 
   | 
||
| 
     #define HAVE_ST_RDEV 1 
   | 
||
| 
     #define HAVE_STRUCT_TIMEVAL 1 
   | 
||
| 
     !if $(MSC_VER) >= 1900 
   | 
||
| 
     #define HAVE_STRUCT_TIMESPEC 
   | 
||
| 
     !endif 
   | 
||
| 
     !if $(MSC_VER) >= 1600 
   | 
||
| 
     #define HAVE_STDINT_H 1 
   | 
||
| 
     !else 
   | 
||
| win32/mkexports.rb | ||
|---|---|---|
| 
         read_substitution(incdir+"/subst.h", syms, winapis) 
   | 
||
| 
         syms["rb_w32_vsnprintf"] ||= "ruby_vsnprintf" 
   | 
||
| 
         syms["rb_w32_snprintf"] ||= "ruby_snprintf" 
   | 
||
| 
         @syms = syms 
   | 
||
| 
         @syms = syms.reject {|k,v| k.index('_xmm') } 
   | 
||
| 
       end 
   | 
||
| 
       def read_substitution(header, syms, winapis) 
   | 
||
| ... | ... | |
| 
             when /OBJECT/, /LIBRARY/ 
   | 
||
| 
               next if /^[[:xdigit:]]+ 0+ UNDEF / =~ l 
   | 
||
| 
               next unless /External/ =~ l 
   | 
||
| 
               next if /(?:_local_stdio_printf_options|v(f|sn?)printf_l)\Z/ =~ l 
   | 
||
| 
               next unless l.sub!(/.*?\s(\(\)\s+)?External\s+\|\s+/, '') 
   | 
||
| 
               is_data = !$1 
   | 
||
| 
               if noprefix or /^[@_]/ =~ l 
   | 
||
| win32/rtname.cmd | ||
|---|---|---|
| 
     set rtver= 
   | 
||
| 
     set osver= 
   | 
||
| 
     for /f "usebackq" %%I in (`dumpbin -dependents %1 ^| findstr -r -i "\<msvcr.*\.dll$"`) do set rt=%%~nI 
   | 
||
| 
     if "%rt%" == "" ( 
   | 
||
| 
         (echo %0: %1 is not linked to msvcrt) 1>&2 
   | 
||
| 
         exit 1 
   | 
||
| 
     ) 
   | 
||
| 
     if "%rt%" NEQ "" goto :msvcr 
   | 
||
| 
     for /f "usebackq" %%I in (`dumpbin -dependents %1 ^| findstr -r -i "\<vcruntime.*\.dll$"`) do set rt=%%~nI 
   | 
||
| 
     if "%rt%" NEQ "" goto :vcruntime 
   | 
||
| 
     (echo %0: %1 is not linked to msvcrt nor vcruntime) 1>&2 
   | 
||
| 
     exit 1 
   | 
||
| 
     :msvcr 
   | 
||
| 
     for %%i in (a b c d e f g h i j k l m n o p q r s t u v w x y z) do @call set rt=%%rt:%%i=%%i%% 
   | 
||
| 
     if "%rt%" == "msvcrt" ( 
   | 
||
| 
         call set rtver=60 
   | 
||
| ... | ... | |
| 
         call set rt=msvcr%%rtver%% 
   | 
||
| 
         call set osver=_%%rtver%% 
   | 
||
| 
     ) 
   | 
||
| 
     goto :exit 
   | 
||
| 
     :vcruntime 
   | 
||
| 
     for %%i in (a b c d e f g h i j k l m n o p q r s t u v w x y z) do @call set rt=%%rt:%%i=%%i%% 
   | 
||
| 
     call set rtver=%%rt:vcruntime=%% 
   | 
||
| 
     call set rt=vcruntime%%rtver%% 
   | 
||
| 
     call set osver=_%%rtver%% 
   | 
||
| 
     :exit 
   | 
||
| 
     for %%I in ("PLATFORM = $(TARGET_OS)%osver%" "RT = %rt%" "RT_VER = %rtver%") do @echo %%~I 
   | 
||
| win32/win32.c | ||
|---|---|---|
| 
     /* License: Ruby's */ 
   | 
||
| 
     typedef struct	{ 
   | 
||
| 
     #if RUBY_MSVCRT_VERSION >= 140 
   | 
||
| 
         CRITICAL_SECTION           lock; 
   | 
||
| 
         intptr_t                   osfhnd;          // underlying OS file HANDLE 
   | 
||
| 
         __int64                    startpos;        // File position that matches buffer start 
   | 
||
| 
         unsigned char              osfile;          // Attributes of file (e.g., open in text mode?) 
   | 
||
| 
         char      textmode; // __crt_lowio_text_mode 
   | 
||
| 
         char _pipe_lookahead[3]; 
   | 
||
| 
         uint8_t unicode          : 1; // Was the file opened as unicode? 
   | 
||
| 
         uint8_t utf8translations : 1; // Buffer contains translations other than CRLF 
   | 
||
| 
         uint8_t dbcsBufferUsed   : 1; // Is the dbcsBuffer in use? 
   | 
||
| 
         char    dbcsBuffer;           // Buffer for the lead byte of DBCS when converting from DBCS to Unicode 
   | 
||
| 
     #else 
   | 
||
| 
         intptr_t osfhnd;	/* underlying OS file HANDLE */ 
   | 
||
| 
         char osfile;	/* attributes of file (e.g., open in text mode?) */ 
   | 
||
| 
         char pipech;	/* one char buffer for handles opened on pipes */ 
   | 
||
| ... | ... | |
| 
         char textmode; 
   | 
||
| 
         char pipech2[2]; 
   | 
||
| 
     #endif 
   | 
||
| 
     #endif 
   | 
||
| 
     }	ioinfo; 
   | 
||
| 
     #if !defined _CRTIMP || defined __MINGW32__ 
   | 
||
| ... | ... | |
| 
     #endif 
   | 
||
| 
     #if !defined(__BORLANDC__) 
   | 
||
| 
     #if RUBY_MSVCRT_VERSION >= 140 
   | 
||
| 
     static ioinfo ** __pioinfo = NULL; 
   | 
||
| 
     #else 
   | 
||
| 
     EXTERN_C _CRTIMP ioinfo * __pioinfo[]; 
   | 
||
| 
     #endif 
   | 
||
| 
     static inline ioinfo* _pioinfo(int); 
   | 
||
| 
     #define IOINFO_L2E			5 
   | 
||
| 
     #define IOINFO_L2E	(RUBY_MSVCRT_VERSION >= 140 ? 6 : 5) 
   | 
||
| 
     #define IOINFO_ARRAY_ELTS	(1 << IOINFO_L2E) 
   | 
||
| 
     #define _osfhnd(i)  (_pioinfo(i)->osfhnd) 
   | 
||
| 
     #define _osfile(i)  (_pioinfo(i)->osfile) 
   | 
||
| ... | ... | |
| 
     static void 
   | 
||
| 
     set_pioinfo_extra(void) 
   | 
||
| 
     { 
   | 
||
| 
     #if RUBY_MSVCRT_VERSION >= 140 
   | 
||
| 
         // get __pioinfo addr with _isatty 
   | 
||
| 
         HMODULE mod = GetModuleHandle("ucrtbase.dll"); 
   | 
||
| 
         char *addr = (char*)GetProcAddress(mod, "_isatty"); 
   | 
||
| 
         // _osfile(fh) & FDEV /*0x40*/ 
   | 
||
| 
     #if _WIN64 
   | 
||
| 
         // lea rdx,[__pioinfo's addr in RIP-relative 32bit addr] 
   | 
||
| 
         addr += 0x25; 
   | 
||
| 
     # define OPSIZE 3 
   | 
||
| 
         if (memcmp(addr, "\x48\x8d\x15", OPSIZE)) { 
   | 
||
| 
           fprintf(stderr, "unexpected ucrtbase.dll\n"); 
   | 
||
| 
           abort(); 
   | 
||
| 
         } 
   | 
||
| 
         addr += OPSIZE; 
   | 
||
| 
         int32_t rel = *(int32_t*)(addr); 
   | 
||
| 
         char *rip = addr + 4; 
   | 
||
| 
         __pioinfo = (ioinfo**)(rip + rel); 
   | 
||
| 
     #else 
   | 
||
| 
         // mov eax,dword ptr [eax*4+100EB430h] 
   | 
||
| 
         addr += 0x32; 
   | 
||
| 
     # define OPSIZE 3 
   | 
||
| 
         if (memcmp(addr, "\x8B\x04\x85", OPSIZE)) { 
   | 
||
| 
           fprintf(stderr, "unexpected ucrtbase.dll\n"); 
   | 
||
| 
           abort(); 
   | 
||
| 
         } 
   | 
||
| 
         __pioinfo = (ioinfo**)*(intptr_t*)(addr + OPSIZE); 
   | 
||
| 
     #endif 
   | 
||
| 
     #else 
   | 
||
| 
         int fd; 
   | 
||
| 
         fd = _open("NUL", O_RDONLY); 
   | 
||
| ... | ... | |
| 
     	/* not found, maybe something wrong... */ 
   | 
||
| 
     	pioinfo_extra = 0; 
   | 
||
| 
         } 
   | 
||
| 
     #endif 
   | 
||
| 
     } 
   | 
||
| 
     #else 
   | 
||
| 
     #define pioinfo_extra 0 
   | 
||
| ... | ... | |
| 
          (fd)) 
   | 
||
| 
         if (fileno(stdin) < 0) { 
   | 
||
| 
     	stdin->_file = open_null(0); 
   | 
||
| 
     	freopen("NUL", "r+b", stdin); 
   | 
||
| 
         } 
   | 
||
| 
         else { 
   | 
||
| 
     	setmode(fileno(stdin), O_BINARY); 
   | 
||
| 
         } 
   | 
||
| 
         if (fileno(stdout) < 0) { 
   | 
||
| 
     	stdout->_file = open_null(1); 
   | 
||
| 
     	freopen("NUL", "r+b", stdout); 
   | 
||
| 
         } 
   | 
||
| 
         if (fileno(stderr) < 0) { 
   | 
||
| 
     	stderr->_file = open_null(2); 
   | 
||
| 
     	freopen("NUL", "r+b", stderr); 
   | 
||
| 
         } 
   | 
||
| 
         if (nullfd >= 0 && !keep) close(nullfd); 
   | 
||
| 
         setvbuf(stderr, NULL, _IONBF, 0); 
   | 
||
| ... | ... | |
| 
     #define FILE_COUNT _cnt 
   | 
||
| 
     #define FILE_READPTR _ptr 
   | 
||
| 
     #undef fgetc 
   | 
||
| 
     /*#undef fgetc*/ 
   | 
||
| 
     /* License: Ruby's */ 
   | 
||
| 
     int 
   | 
||
| 
     rb_w32_getc(FILE* stream) 
   | 
||
| 
     { 
   | 
||
| 
         int c; 
   | 
||
| 
     #if RUBY_MSVCRT_VERSION >= 140 
   | 
||
| 
         c = _fgetc_nolock(stream); 
   | 
||
| 
         catch_interrupt(); 
   | 
||
| 
     #else 
   | 
||
| 
         if (enough_to_get(stream->FILE_COUNT)) { 
   | 
||
| 
     	c = (unsigned char)*stream->FILE_READPTR++; 
   | 
||
| 
         } 
   | 
||
| ... | ... | |
| 
     #endif 
   | 
||
| 
     	catch_interrupt(); 
   | 
||
| 
         } 
   | 
||
| 
     #endif 
   | 
||
| 
         return c; 
   | 
||
| 
     } 
   | 
||
| 
     #undef fputc 
   | 
||
| 
     /* #undef fputc */ 
   | 
||
| 
     /* License: Ruby's */ 
   | 
||
| 
     int 
   | 
||
| 
     rb_w32_putc(int c, FILE* stream) 
   | 
||
| 
     { 
   | 
||
| 
     #if RUBY_MSVCRT_VERSION >= 140 
   | 
||
| 
         c = _fputc_nolock(c, stream); 
   | 
||
| 
         catch_interrupt(); 
   | 
||
| 
     #else 
   | 
||
| 
         if (enough_to_put(stream->FILE_COUNT)) { 
   | 
||
| 
     	c = (unsigned char)(*stream->FILE_READPTR++ = (char)c); 
   | 
||
| 
         } 
   | 
||
| ... | ... | |
| 
     	c = _flsbuf(c, stream); 
   | 
||
| 
     	catch_interrupt(); 
   | 
||
| 
         } 
   | 
||
| 
     #endif 
   | 
||
| 
         return c; 
   | 
||
| 
     } 
   | 
||
- « Previous
 - 1
 - 2
 - 3
 - Next »