From: Steve Hay Date: Tue, 22 Apr 2008 09:38:45 +0000 (+0000) Subject: Upgrade to Win32-0.36 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b5701e9edddf3f3df00cee80e48223f19407a9bc;p=p5sagit%2Fp5-mst-13.2.git Upgrade to Win32-0.36 p4raw-id: //depot/perl@33720 --- diff --git a/ext/Win32/Changes b/ext/Win32/Changes index 4c21ae7..b8f936c 100644 --- a/ext/Win32/Changes +++ b/ext/Win32/Changes @@ -1,5 +1,8 @@ Revision history for the Perl extension Win32. +0.36 [2008-04-17] + - Add typecasts for Win64 compilation + 0.35 [2008-03-31] Integrate changes from bleadperl: - Silence Borland compiler warning (Steve Hay) diff --git a/ext/Win32/Win32.pm b/ext/Win32/Win32.pm index 5737f83..89ec732 100644 --- a/ext/Win32/Win32.pm +++ b/ext/Win32/Win32.pm @@ -8,7 +8,7 @@ BEGIN { require DynaLoader; @ISA = qw|Exporter DynaLoader|; - $VERSION = '0.35'; + $VERSION = '0.36'; $XS_VERSION = $VERSION; $VERSION = eval $VERSION; diff --git a/ext/Win32/Win32.xs b/ext/Win32/Win32.xs index bbd6ac8..05ab602 100644 --- a/ext/Win32/Win32.xs +++ b/ext/Win32/Win32.xs @@ -158,9 +158,9 @@ sv_to_wstr(pTHX_ SV *sv) char *str = SvPV(sv, len); UINT cp = SvUTF8(sv) ? CP_UTF8 : CP_ACP; - wlen = MultiByteToWideChar(cp, 0, str, len+1, NULL, 0); + wlen = MultiByteToWideChar(cp, 0, str, (int)(len+1), NULL, 0); New(0, wstr, wlen, WCHAR); - MultiByteToWideChar(cp, 0, str, len+1, wstr, wlen); + MultiByteToWideChar(cp, 0, str, (int)(len+1), wstr, wlen); return wstr; } @@ -171,7 +171,7 @@ sv_to_wstr(pTHX_ SV *sv) SV * wstr_to_sv(pTHX_ WCHAR *wstr) { - size_t wlen = wcslen(wstr)+1; + int wlen = (int)wcslen(wstr)+1; BOOL use_default = FALSE; int len = WideCharToMultiByte(CP_ACP, WC_NO_BEST_FIT_CHARS, wstr, wlen, NULL, 0, NULL, NULL); SV *sv = sv_2mortal(newSV(len)); @@ -302,7 +302,7 @@ my_ansipath(const WCHAR *widename) { char *name; BOOL use_default = FALSE; - size_t widelen = wcslen(widename)+1; + int widelen = (int)wcslen(widename)+1; int len = WideCharToMultiByte(CP_ACP, WC_NO_BEST_FIT_CHARS, widename, widelen, NULL, 0, NULL, NULL); New(0, name, len, char); @@ -619,8 +619,8 @@ XS(w32_InitiateSystemShutdown) } message = SvPV_nolen(ST(1)); - bRet = InitiateSystemShutdownA(machineName, message, - SvIV(ST(2)), SvIV(ST(3)), SvIV(ST(4))); + bRet = InitiateSystemShutdownA(machineName, message, (DWORD)SvIV(ST(2)), + (BOOL)SvIV(ST(3)), (BOOL)SvIV(ST(4))); /* Disable shutdown privilege. */ tkp.Privileges[0].Attributes = 0; @@ -680,7 +680,7 @@ XS(w32_MsgBox) croak("usage: Win32::MsgBox($message [, $flags [, $title]]);\n"); if (items > 1) - flags = SvIV(ST(1)); + flags = (DWORD)SvIV(ST(1)); if (IsWin2000()) { WCHAR *title = NULL; @@ -710,7 +710,11 @@ XS(w32_LoadLibrary) if (items != 1) croak("usage: Win32::LoadLibrary($libname)\n"); hHandle = LoadLibraryA(SvPV_nolen(ST(0))); - XSRETURN_IV((long)hHandle); +#ifdef _WIN64 + XSRETURN_IV((DWORD_PTR)hHandle); +#else + XSRETURN_IV((DWORD)hHandle); +#endif } XS(w32_FreeLibrary) @@ -804,7 +808,7 @@ XS(w32_GuidGen) if (SUCCEEDED(hr)) { LPOLESTR pStr = NULL; if (SUCCEEDED(StringFromCLSID(&guid, &pStr))) { - WideCharToMultiByte(CP_ACP, 0, pStr, wcslen(pStr), szGUID, + WideCharToMultiByte(CP_ACP, 0, pStr, (int)wcslen(pStr), szGUID, sizeof(szGUID), NULL, NULL); CoTaskMemFree(pStr); XSRETURN_PV(szGUID); @@ -825,7 +829,7 @@ XS(w32_GetFolderPath) if (items != 1 && items != 2) croak("usage: Win32::GetFolderPath($csidl [, $create])\n"); - folder = SvIV(ST(0)); + folder = (int)SvIV(ST(0)); if (items == 2) create = SvTRUE(ST(1)) ? CSIDL_FLAG_CREATE : 0; @@ -1112,7 +1116,7 @@ XS(w32_SetLastError) dXSARGS; if (items != 1) Perl_croak(aTHX_ "usage: Win32::SetLastError($error)"); - SetLastError(SvIV(ST(0))); + SetLastError((DWORD)SvIV(ST(0))); XSRETURN_EMPTY; } @@ -1284,7 +1288,7 @@ XS(w32_FormatMessage) Perl_croak(aTHX_ "usage: Win32::FormatMessage($errno)"); if (FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, - &source, SvIV(ST(0)), 0, + &source, (DWORD)SvIV(ST(0)), 0, msgbuf, sizeof(msgbuf)-1, NULL)) { XSRETURN_PV(msgbuf); @@ -1381,7 +1385,7 @@ XS(w32_GetShortPathName) do { len = GetShortPathName(SvPVX(shortpath), SvPVX(shortpath), - SvLEN(shortpath)); + (DWORD)SvLEN(shortpath)); } while (len >= SvLEN(shortpath) && sv_grow(shortpath,len+1)); if (len) { SvCUR_set(shortpath,len); @@ -1550,7 +1554,7 @@ XS(w32_Sleep) dXSARGS; if (items != 1) Perl_croak(aTHX_ "usage: Win32::Sleep($milliseconds)"); - Sleep(SvIV(ST(0))); + Sleep((DWORD)SvIV(ST(0))); XSRETURN_YES; }