summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>2004-03-04 10:35:59 +0000
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2004-03-04 10:35:59 +0000
commit95015c6ec741dc7f61e7b9c294102b0f8e739263 (patch)
tree9be95c8007f27109ff8c6e230d6fa519c0826dc4
parent2c9359a248d51da75ec39822c411d2e97fe5c631 (diff)
downloadperl-95015c6ec741dc7f61e7b9c294102b0f8e739263.tar.gz
Fix [perl #27357] Scalar Win32::GetOSVersion() broken in 5.8.3
(by Steve Hay) p4raw-id: //depot/perl@22431
-rw-r--r--MANIFEST1
-rw-r--r--t/win32/getosversion.t13
-rw-r--r--win32/win32.c6
3 files changed, 20 insertions, 0 deletions
diff --git a/MANIFEST b/MANIFEST
index 2d038bd3d4..91479a5bee 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -2949,6 +2949,7 @@ t/uni/tr_sjis.t See if Unicode tr/// works
t/uni/tr_utf8.t See if Unicode tr/// works
t/uni/upper.t See if Unicode casing works
t/uni/write.t See if Unicode formats work
+t/win32/getosversion.t Test if Win32::GetOSVersion() works
t/win32/longpath.t Test if Win32::GetLongPathName() works
t/win32/system.t See if system works in Win*
t/win32/system_tests Test runner for system.t
diff --git a/t/win32/getosversion.t b/t/win32/getosversion.t
new file mode 100644
index 0000000000..2a708cb80a
--- /dev/null
+++ b/t/win32/getosversion.t
@@ -0,0 +1,13 @@
+#!perl -w
+
+# tests for Win32::GetOSVersion()
+
+$^O =~ /^MSWin/ or print("1..0 # not win32\n" ), exit;
+
+print "1..1\n";
+
+my $scalar = Win32::GetOSVersion();
+my @array = Win32::GetOSVersion();
+
+print "not " unless $scalar == $array[4];
+print "ok 1\n";
diff --git a/win32/win32.c b/win32/win32.c
index f4c43fc6de..19662af800 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -4618,6 +4618,9 @@ XS(w32_GetOSVersion)
XSRETURN_EMPTY;
}
}
+ if (GIMME_V == G_SCALAR) {
+ XSRETURN_IV(osverw.dwPlatformId);
+ }
W2AHELPER(osverw.szCSDVersion, szCSDVersion, sizeof(szCSDVersion));
XPUSHs(newSVpvn(szCSDVersion, strlen(szCSDVersion)));
osver.dwMajorVersion = osverw.dwMajorVersion;
@@ -4638,6 +4641,9 @@ XS(w32_GetOSVersion)
XSRETURN_EMPTY;
}
}
+ if (GIMME_V == G_SCALAR) {
+ XSRETURN_IV(osver.dwPlatformId);
+ }
XPUSHs(newSVpvn(osver.szCSDVersion, strlen(osver.szCSDVersion)));
}
XPUSHs(newSViv(osver.dwMajorVersion));