In perl.git, the branch blead has been updated

<https://perl5.git.perl.org/perl.git/commitdiff/95f2d7953c267bf92f44bedf730ca2c26e8f338e?hp=5de6cd706e406902d8d24f62fe0fb81ebbb8c0dc>

- Log -----------------------------------------------------------------
commit 95f2d7953c267bf92f44bedf730ca2c26e8f338e
Author: Chris 'BinGOs' Williams <ch...@bingosnet.co.uk>
Date:   Tue Aug 6 11:47:02 2019 +0100

    Update Win32 to CPAN version 0.53
    
      [DELTA]
    
    0.53  [2019-08-05]
            - improve Win32::GetOSDisplayName
            - added Win2016/2019 detection and version information by
              Richard Leach [PR/15]
            - Include wchar.h to allow building with g++ by Tony Cook 
[rt#127836]
    
    0.52_02 [2018-11-02] by Reini Urban
            - added () usage croaks.
            - Fixed a -Warray-bounds buffer overflow in LONGPATH,
            - Fix various -Wunused warnings
              and two -Wmaybe-uninitialized.
    
    0.52_01 [2017-11-30]
            - add missing const

-----------------------------------------------------------------------

Summary of changes:
 Porting/Maintainers.pl  |  2 +-
 cpan/Win32/Win32.pm     |  2 +-
 cpan/Win32/Win32.xs     | 88 ++++++++++++++++++++++++++++++++++++++-----------
 cpan/Win32/longpath.inc |  2 +-
 4 files changed, 71 insertions(+), 23 deletions(-)

diff --git a/Porting/Maintainers.pl b/Porting/Maintainers.pl
index 042816c7cd..e302036dc9 100755
--- a/Porting/Maintainers.pl
+++ b/Porting/Maintainers.pl
@@ -1244,7 +1244,7 @@ use File::Glob qw(:case);
     },
 
     'Win32' => {
-        'DISTRIBUTION' => "JDB/Win32-0.52.tar.gz",
+        'DISTRIBUTION' => "JDB/Win32-0.53.tar.gz",
         'FILES'        => q[cpan/Win32],
     },
 
diff --git a/cpan/Win32/Win32.pm b/cpan/Win32/Win32.pm
index 7b9ab455be..5a197e9e9e 100644
--- a/cpan/Win32/Win32.pm
+++ b/cpan/Win32/Win32.pm
@@ -8,7 +8,7 @@ package Win32;
     require DynaLoader;
 
     @ISA = qw|Exporter DynaLoader|;
-    $VERSION = '0.52';
+    $VERSION = '0.53';
     $XS_VERSION = $VERSION;
     $VERSION = eval $VERSION;
 
diff --git a/cpan/Win32/Win32.xs b/cpan/Win32/Win32.xs
index de3764edab..03519cbc3a 100644
--- a/cpan/Win32/Win32.xs
+++ b/cpan/Win32/Win32.xs
@@ -1,7 +1,9 @@
 #define WIN32_LEAN_AND_MEAN
+#include <wchar.h>
 #include <wctype.h>
 #include <windows.h>
 #include <shlobj.h>
+#include <wchar.h>
 
 #define PERL_NO_GET_CONTEXT
 #include "EXTERN.h"
@@ -114,7 +116,7 @@ typedef void (WINAPI *PFNGetNativeSystemInfo)(LPSYSTEM_INFO 
lpSystemInfo);
  * WORD type has been replaced by unsigned short because
  * WORD is already used by Perl itself.
  */
-struct {
+struct g_osver_t {
     DWORD dwOSVersionInfoSize;
     DWORD dwMajorVersion;
     DWORD dwMinorVersion;
@@ -126,7 +128,7 @@ struct {
     unsigned short wSuiteMask;
     BYTE  wProductType;
     BYTE  wReserved;
-}   g_osver = {0, 0, 0, 0, 0, "", 0, 0, 0, 0, 0};
+} g_osver = {0, 0, 0, 0, 0, "", 0, 0, 0, 0, 0};
 BOOL g_osver_ex = TRUE;
 
 #define ONE_K_BUFSIZE  1024
@@ -201,7 +203,7 @@ wstr_to_sv(pTHX_ WCHAR *wstr)
  * characters for the characters not in the ANSI codepage.
  */
 SV*
-get_unicode_env(pTHX_ WCHAR *name)
+get_unicode_env(pTHX_ const WCHAR *name)
 {
     SV *sv = NULL;
     void *env;
@@ -377,6 +379,7 @@ get_childenv(void)
 void
 free_childenv(void *d)
 {
+  PERL_UNUSED_ARG(d);
 }
 
 #  define PerlDir_mapA(dir) (dir)
@@ -388,7 +391,7 @@ XS(w32_ExpandEnvironmentStrings)
     dXSARGS;
 
     if (items != 1)
-       croak("usage: Win32::ExpandEnvironmentStrings($String);\n");
+       croak("usage: Win32::ExpandEnvironmentStrings($String)");
 
     if (IsWin2000()) {
         WCHAR value[31*1024];
@@ -536,7 +539,7 @@ XS(w32_LookupAccountName)
 
     if (items != 5)
        croak("usage: Win32::LookupAccountName($system, $account, $domain, "
-             "$sid, $sidtype);\n");
+             "$sid, $sidtype)");
 
     SIDLen = sizeof(SID);
     DomLen = sizeof(Domain);
@@ -570,7 +573,7 @@ XS(w32_LookupAccountSID)
     BOOL bResult;
 
     if (items != 5)
-       croak("usage: Win32::LookupAccountSID($system, $sid, $account, $domain, 
$sidtype);\n");
+       croak("usage: Win32::LookupAccountSID($system, $sid, $account, $domain, 
$sidtype)");
 
     sid = SvPV_nolen(ST(1));
     if (IsValidSid(sid)) {
@@ -601,7 +604,7 @@ XS(w32_InitiateSystemShutdown)
 
     if (items != 5)
        croak("usage: Win32::InitiateSystemShutdown($machineName, $message, "
-             "$timeOut, $forceClose, $reboot);\n");
+             "$timeOut, $forceClose, $reboot)");
 
     machineName = SvPV_nolen(ST(0));
 
@@ -642,7 +645,7 @@ XS(w32_AbortSystemShutdown)
     char *machineName;
 
     if (items != 1)
-       croak("usage: Win32::AbortSystemShutdown($machineName);\n");
+       croak("usage: Win32::AbortSystemShutdown($machineName)");
 
     machineName = SvPV_nolen(ST(0));
 
@@ -680,7 +683,7 @@ XS(w32_MsgBox)
     I32 result;
 
     if (items < 1 || items > 3)
-       croak("usage: Win32::MsgBox($message [, $flags [, $title]]);\n");
+       croak("usage: Win32::MsgBox($message [, $flags [, $title]])");
 
     if (items > 1)
         flags = (DWORD)SvIV(ST(1));
@@ -696,7 +699,7 @@ XS(w32_MsgBox)
             Safefree(title);
     }
     else {
-        char *title = "Perl";
+        const char *title = "Perl";
         char *msg = SvPV_nolen(ST(0));
         if (items > 2)
             title = SvPV_nolen(ST(2));
@@ -787,6 +790,8 @@ XS(w32_UnregisterServer)
 XS(w32_GetArchName)
 {
     dXSARGS;
+    if (items)
+       Perl_croak(aTHX_ "usage: Win32::GetArchName()");
     XSRETURN_PV(getenv("PROCESSOR_ARCHITECTURE"));
 }
 
@@ -796,6 +801,8 @@ XS(w32_GetChipName)
     SYSTEM_INFO sysinfo;
     HMODULE module;
     PFNGetNativeSystemInfo pfnGetNativeSystemInfo;
+    if (items)
+       Perl_croak(aTHX_ "usage: Win32::GetChipName()");
 
     Zero(&sysinfo,1,SYSTEM_INFO);
     module = GetModuleHandle("kernel32.dll");
@@ -814,8 +821,11 @@ XS(w32_GuidGen)
     dXSARGS;
     GUID guid;
     char szGUID[50] = {'\0'};
-    HRESULT  hr     = CoCreateGuid(&guid);
+    HRESULT  hr;
+    if (items)
+       Perl_croak(aTHX_ "usage: Win32::GuidGen()");
 
+    hr     = CoCreateGuid(&guid);
     if (SUCCEEDED(hr)) {
        LPOLESTR pStr = NULL;
 #ifdef __cplusplus
@@ -896,7 +906,7 @@ XS(w32_GetFolderPath)
         SV *sv;
         HKEY hkey;
         HKEY root = HKEY_CURRENT_USER;
-        WCHAR *name = NULL;
+        const WCHAR *name = NULL;
 
         switch (folder) {
         case CSIDL_ADMINTOOLS:                  name = L"Administrative 
Tools";        break;
@@ -997,7 +1007,7 @@ XS(w32_GetFileVersion)
     char *data;
 
     if (items != 1)
-       croak("usage: Win32::GetFileVersion($filename)\n");
+       croak("usage: Win32::GetFileVersion($filename)");
 
     filename = SvPV_nolen(ST(0));
     size = GetFileVersionInfoSize(filename, &handle);
@@ -1048,7 +1058,9 @@ XS(w32_SetChildShowWindow)
      * inside the thread_intern structure, the MSWin32 implementation
      * lives in win32/win32.c in the core Perl distribution.
      */
-    dXSARGS;
+    dSP;
+    I32 ax = POPMARK;
+    EXTEND(SP,1);
     XSRETURN_UNDEF;
 }
 #endif
@@ -1056,8 +1068,12 @@ XS(w32_SetChildShowWindow)
 XS(w32_GetCwd)
 {
     dXSARGS;
+    char* ptr;
+    if (items)
+       Perl_croak(aTHX_ "usage: Win32::GetCwd()");
+
     /* Make the host for current directory */
-    char* ptr = PerlEnv_get_childdir();
+    ptr = PerlEnv_get_childdir();
     /*
      * If ptr != Nullch
      *   then it worked, set PV valid,
@@ -1108,6 +1124,8 @@ XS(w32_GetNextAvailDrive)
     char ix = 'C';
     char root[] = "_:\\";
 
+    if (items)
+       Perl_croak(aTHX_ "usage: Win32::GetNextAvailDrive()");
     EXTEND(SP,1);
     while (ix <= 'Z') {
        root[0] = ix++;
@@ -1122,6 +1140,8 @@ XS(w32_GetNextAvailDrive)
 XS(w32_GetLastError)
 {
     dXSARGS;
+    if (items)
+       Perl_croak(aTHX_ "usage: Win32::GetLastError()");
     EXTEND(SP,1);
     XSRETURN_IV(GetLastError());
 }
@@ -1138,6 +1158,8 @@ XS(w32_SetLastError)
 XS(w32_LoginName)
 {
     dXSARGS;
+    if (items)
+       Perl_croak(aTHX_ "usage: Win32::LoginName()");
     EXTEND(SP,1);
     if (IsWin2000()) {
         WCHAR name[128];
@@ -1164,6 +1186,8 @@ XS(w32_NodeName)
     dXSARGS;
     char name[MAX_COMPUTERNAME_LENGTH+1];
     DWORD size = sizeof(name);
+    if (items)
+       Perl_croak(aTHX_ "usage: Win32::NodeName()");
     EXTEND(SP,1);
     if (GetComputerName(name,&size)) {
        /* size does NOT include NULL :-( */
@@ -1178,9 +1202,11 @@ XS(w32_DomainName)
 {
     dXSARGS;
     HMODULE module = LoadLibrary("netapi32.dll");
-    PFNNetApiBufferFree pfnNetApiBufferFree;
-    PFNNetWkstaGetInfo pfnNetWkstaGetInfo;
+    PFNNetApiBufferFree pfnNetApiBufferFree = NULL;
+    PFNNetWkstaGetInfo pfnNetWkstaGetInfo = NULL;
 
+    if (items)
+       Perl_croak(aTHX_ "usage: Win32::DomainName()");
     if (module) {
         GETPROC(NetApiBufferFree);
         GETPROC(NetWkstaGetInfo);
@@ -1242,8 +1268,10 @@ XS(w32_FsType)
     dXSARGS;
     char fsname[256];
     DWORD flags, filecomplen;
+    if (items)
+       Perl_croak(aTHX_ "usage: Win32::FsType()");
     if (GetVolumeInformation(NULL, NULL, 0, NULL, &filecomplen,
-                        &flags, fsname, sizeof(fsname))) {
+                             &flags, fsname, sizeof(fsname))) {
        if (GIMME_V == G_ARRAY) {
            XPUSHs(sv_2mortal(newSVpvn(fsname,strlen(fsname))));
            XPUSHs(sv_2mortal(newSViv(flags)));
@@ -1260,6 +1288,8 @@ XS(w32_FsType)
 XS(w32_GetOSVersion)
 {
     dXSARGS;
+    if (items)
+       Perl_croak(aTHX_ "usage: Win32::GetOSVersion()");
 
     if (GIMME_V == G_SCALAR) {
         XSRETURN_IV(g_osver.dwPlatformId);
@@ -1282,6 +1312,8 @@ XS(w32_GetOSVersion)
 XS(w32_IsWinNT)
 {
     dXSARGS;
+    if (items)
+       Perl_croak(aTHX_ "usage: Win32::IsWinNT()");
     EXTEND(SP,1);
     XSRETURN_IV(IsWinNT());
 }
@@ -1289,6 +1321,8 @@ XS(w32_IsWinNT)
 XS(w32_IsWin95)
 {
     dXSARGS;
+    if (items)
+       Perl_croak(aTHX_ "usage: Win32::IsWin95()");
     EXTEND(SP,1);
     XSRETURN_IV(IsWin95());
 }
@@ -1364,6 +1398,8 @@ XS(w32_GetTickCount)
 {
     dXSARGS;
     DWORD msec = GetTickCount();
+    if (items)
+       Perl_croak(aTHX_ "usage: Win32::GetTickCount()");
     EXTEND(SP,1);
     if ((IV)msec > 0)
        XSRETURN_IV(msec);
@@ -1525,7 +1561,7 @@ XS(w32_GetLongPathName)
         WCHAR wide_path[MAX_PATH+1];
         WCHAR *long_path;
 
-        if (wcslen(wstr) < countof(wide_path)) {
+        if (wcslen(wstr) < (size_t)countof(wide_path)) {
             wcscpy(wide_path, wstr);
             long_path = my_longpathW(wide_path);
             if (long_path) {
@@ -1619,6 +1655,8 @@ XS(w32_OutputDebugString)
 XS(w32_GetCurrentProcessId)
 {
     dXSARGS;
+    if (items)
+       Perl_croak(aTHX_ "usage: Win32::GetCurrentProcessId()");
     EXTEND(SP,1);
     XSRETURN_IV(GetCurrentProcessId());
 }
@@ -1626,6 +1664,8 @@ XS(w32_GetCurrentProcessId)
 XS(w32_GetCurrentThreadId)
 {
     dXSARGS;
+    if (items)
+       Perl_croak(aTHX_ "usage: Win32::GetCurrentThreadId()");
     EXTEND(SP,1);
     XSRETURN_IV(GetCurrentThreadId());
 }
@@ -1713,6 +1753,8 @@ XS(w32_GetProductInfo)
 XS(w32_GetACP)
 {
     dXSARGS;
+    if (items)
+       Perl_croak(aTHX_ "usage: Win32::GetACP()");
     EXTEND(SP,1);
     XSRETURN_IV(GetACP());
 }
@@ -1720,6 +1762,8 @@ XS(w32_GetACP)
 XS(w32_GetConsoleCP)
 {
     dXSARGS;
+    if (items)
+       Perl_croak(aTHX_ "usage: Win32::GetConsoleCP()");
     EXTEND(SP,1);
     XSRETURN_IV(GetConsoleCP());
 }
@@ -1727,6 +1771,8 @@ XS(w32_GetConsoleCP)
 XS(w32_GetConsoleOutputCP)
 {
     dXSARGS;
+    if (items)
+       Perl_croak(aTHX_ "usage: Win32::GetConsoleOutputCP()");
     EXTEND(SP,1);
     XSRETURN_IV(GetConsoleOutputCP());
 }
@@ -1734,6 +1780,8 @@ XS(w32_GetConsoleOutputCP)
 XS(w32_GetOEMCP)
 {
     dXSARGS;
+    if (items)
+       Perl_croak(aTHX_ "usage: Win32::GetOEMCP()");
     EXTEND(SP,1);
     XSRETURN_IV(GetOEMCP());
 }
@@ -1764,7 +1812,7 @@ PROTOTYPES: DISABLE
 
 BOOT:
 {
-    char *file = __FILE__;
+    const char *file = __FILE__;
 
     if (g_osver.dwOSVersionInfoSize == 0) {
         g_osver.dwOSVersionInfoSize = sizeof(g_osver);
diff --git a/cpan/Win32/longpath.inc b/cpan/Win32/longpath.inc
index ea6c1de48a..429e65d00c 100644
--- a/cpan/Win32/longpath.inc
+++ b/cpan/Win32/longpath.inc
@@ -81,7 +81,7 @@ LONGPATH(CHAR_T *path)
        *start = sep;
        if (fhand != INVALID_HANDLE_VALUE) {
            STRLEN len = FN_STRLEN(fdata.cFileName);
-           if ((STRLEN)(tmpbuf + sizeof(tmpbuf) - tmpstart) > len) {
+           if (len < (STRLEN)(tmpbuf - tmpstart + sizeof(tmpbuf))) {
                FN_STRCPY(tmpstart, fdata.cFileName);
                tmpstart += len;
                FindClose(fhand);

-- 
Perl5 Master Repository

Reply via email to