From e8c91745d8852a847a6dace5962c919c92d54011 Mon Sep 17 00:00:00 2001 From: Martin Date: Sun, 28 Sep 2014 00:37:42 +0200 Subject: [PATCH 1/3] core.stdc.stdio: fix fpos_t for MSVCRT --- src/core/stdc/stdio.d | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/stdc/stdio.d b/src/core/stdc/stdio.d index 18db615f1d..d0eba8ac17 100644 --- a/src/core/stdc/stdio.d +++ b/src/core/stdc/stdio.d @@ -259,7 +259,7 @@ version( CRuntime_DigitalMars ) else version( CRuntime_Microsoft ) { /// - alias int fpos_t; //check this + alias long fpos_t; /// struct _iobuf From 224226e24c7aa05174a8ca10138aa64185aafe79 Mon Sep 17 00:00:00 2001 From: Martin Date: Sun, 28 Sep 2014 00:42:01 +0200 Subject: [PATCH 2/3] core.stdc.stdio: let fputc/fgetc_nolock operate on _iobuf (non-shared FILE) (for MSVCRT) --- src/core/stdc/stdio.d | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/core/stdc/stdio.d b/src/core/stdc/stdio.d index d0eba8ac17..0e309fcfec 100644 --- a/src/core/stdc/stdio.d +++ b/src/core/stdc/stdio.d @@ -965,12 +965,12 @@ else version( CRuntime_Microsoft ) enum _TWO_DIGIT_EXPONENT = 1; /// - int _filbuf(FILE *fp); + int _filbuf(_iobuf* fp); /// - int _flsbuf(int c, FILE *fp); + int _flsbuf(int c, _iobuf* fp); /// - int _fputc_nolock(int c, FILE *fp) + int _fputc_nolock(int c, _iobuf* fp) { fp._cnt = fp._cnt - 1; if (fp._cnt >= 0) @@ -984,7 +984,7 @@ else version( CRuntime_Microsoft ) } /// - int _fgetc_nolock(FILE *fp) + int _fgetc_nolock(_iobuf* fp) { fp._cnt = fp._cnt - 1; if (fp._cnt >= 0) From e9c2d5ca2600664034817f1aa5568a82736a5912 Mon Sep 17 00:00:00 2001 From: Martin Date: Sun, 28 Sep 2014 00:45:20 +0200 Subject: [PATCH 3/3] core.stdc.stdio: prepare transition to MSVCRT 14 (incl. standard-conformant (v)snprintf) --- src/core/stdc/stdio.d | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/core/stdc/stdio.d b/src/core/stdc/stdio.d index 0e309fcfec..42c099bfc6 100644 --- a/src/core/stdc/stdio.d +++ b/src/core/stdc/stdio.d @@ -949,7 +949,17 @@ else version( CRuntime_Microsoft ) /// pure int fileno(FILE* stream) { return stream._file; } } - /// + + version( None ) // requires MSVCRT >= 14 (VS 2015) + { + /// + int snprintf(char* s, size_t n, in char* fmt, ...); + /// + int vsnprintf(char* s, size_t n, in char* format, va_list arg); + } + else + { + /// int _snprintf(char* s, size_t n, in char* fmt, ...); /// alias _snprintf snprintf; @@ -996,6 +1006,7 @@ else version( CRuntime_Microsoft ) else return _filbuf(fp); } + } /// int _lock_file(FILE *fp);