Skip to content

Commit e283093

Browse files
committed
Merge pull request #3304 from kinke/vs2015
Fix a couple of issues wrt. Visual Studio 2015
2 parents 497aa3b + 5ddd7e5 commit e283093

File tree

4 files changed

+19
-9
lines changed

4 files changed

+19
-9
lines changed

std/conv.d

+11-4
Original file line numberDiff line numberDiff line change
@@ -2973,12 +2973,19 @@ unittest
29732973
ld = parse!real(s2);
29742974
assert(s2.empty);
29752975
x = *cast(longdouble *)&ld;
2976-
version (CRuntime_Microsoft)
2977-
ld1 = 0x1.FFFFFFFFFFFFFFFEp-16382L; // strtold currently mapped to strtod
2978-
else version (Android)
2979-
ld1 = 0x1.FFFFFFFFFFFFFFFEp-16382L; // strtold currently mapped to strtod
2976+
2977+
static if(real.mant_dig == 64)
2978+
{
2979+
version (CRuntime_Microsoft)
2980+
ld1 = 0x1.FFFFFFFFFFFFFFFEp-16382L; // strtold currently mapped to strtod
2981+
else version (Android)
2982+
ld1 = 0x1.FFFFFFFFFFFFFFFEp-16382L; // strtold currently mapped to strtod
2983+
else
2984+
ld1 = strtold(s.ptr, null);
2985+
}
29802986
else
29812987
ld1 = strtold(s.ptr, null);
2988+
29822989
x1 = *cast(longdouble *)&ld1;
29832990
assert(x1 == x && ld1 == ld);
29842991

std/format.d

+6-3
Original file line numberDiff line numberDiff line change
@@ -3728,7 +3728,8 @@ unittest
37283728
}
37293729
else version (CRuntime_Microsoft)
37303730
{
3731-
assert(stream.data == "1.67 -0X1.47AE14P+0 nan",
3731+
assert(stream.data == "1.67 -0X1.47AE14P+0 nan"
3732+
|| stream.data == "1.67 -0X1.47AE147AE147BP+0 nan", // MSVCRT 14+ (VS 2015)
37323733
stream.data);
37333734
}
37343735
else version (Android)
@@ -3764,7 +3765,8 @@ unittest
37643765
formattedWrite(stream, "%a %A", 1.32, 6.78f);
37653766
//formattedWrite(stream, "%x %X", 1.32);
37663767
version (CRuntime_Microsoft)
3767-
assert(stream.data == "0x1.51eb85p+0 0X1.B1EB86P+2");
3768+
assert(stream.data == "0x1.51eb85p+0 0X1.B1EB86P+2"
3769+
|| stream.data == "0x1.51eb851eb851fp+0 0X1.B1EB860000000P+2"); // MSVCRT 14+ (VS 2015)
37683770
else version (Android)
37693771
{
37703772
// bionic doesn't support hex formatting of floating point numbers,
@@ -6246,7 +6248,8 @@ unittest
62466248
version (MinGW)
62476249
assert(s == "1.67 -0XA.3D70A3D70A3D8P-3 nan", s);
62486250
else version (CRuntime_Microsoft)
6249-
assert(s == "1.67 -0X1.47AE14P+0 nan", s);
6251+
assert(s == "1.67 -0X1.47AE14P+0 nan"
6252+
|| s == "1.67 -0X1.47AE147AE147BP+0 nan", s); // MSVCRT 14+ (VS 2015)
62506253
else version (Android)
62516254
{
62526255
// bionic doesn't support hex formatting of floating point numbers

std/outbuffer.d

+1-1
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ class OutBuffer
269269
{
270270
version(Windows)
271271
{
272-
count = _vsnprintf(p,psize,f,args);
272+
count = vsnprintf(p,psize,f,args);
273273
if (count != -1)
274274
break;
275275
psize *= 2;

std/stream.d

+1-1
Original file line numberDiff line numberDiff line change
@@ -1181,7 +1181,7 @@ class Stream : InputStream, OutputStream {
11811181
size_t count;
11821182
while (true) {
11831183
version (Windows) {
1184-
count = _vsnprintf(p, psize, f, args);
1184+
count = vsnprintf(p, psize, f, args);
11851185
if (count != -1)
11861186
break;
11871187
psize *= 2;

0 commit comments

Comments
 (0)