From: Rafael Garcia-Suarez Date: Thu, 4 Mar 2004 10:35:59 +0000 (+0000) Subject: Fix [perl #27357] Scalar Win32::GetOSVersion() broken in 5.8.3 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=95015c6ec741dc7f61e7b9c294102b0f8e739263;p=p5sagit%2Fp5-mst-13.2.git Fix [perl #27357] Scalar Win32::GetOSVersion() broken in 5.8.3 (by Steve Hay) p4raw-id: //depot/perl@22431 --- diff --git a/MANIFEST b/MANIFEST index 2d038bd..91479a5 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 0000000..2a708cb --- /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 f4c43fc..19662af 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));