Fix MSVC/x64 warnings

svn path=/trunk/; revision=67148
This commit is contained in:
Timo Kreuzer 2015-04-11 08:17:03 +00:00
parent 5956c4372a
commit 1d742c54fb
7 changed files with 40 additions and 20 deletions

View file

@ -137,7 +137,7 @@ GdipGetSupportedFileExtensions(VOID)
size = 0; size = 0;
for (i = 0; i < num; ++i) for (i = 0; i < num; ++i)
{ {
size = size + wcslen(codecInfo[i].FilenameExtension) + 1; size = size + (UINT)wcslen(codecInfo[i].FilenameExtension) + 1;
} }
size = (size + 1) * sizeof(WCHAR); size = (size + 1) * sizeof(WCHAR);
@ -238,7 +238,7 @@ AddWallpapersFromDirectory(UINT uCounter, HWND hwndBackgroundList, BackgroundIte
} }
PathRemoveExtension(backgroundItem->szDisplayName); PathRemoveExtension(backgroundItem->szDisplayName);
hr = StringCbCopy(backgroundItem->szFilename, sizeof(backgroundItem->szFilename), filename); hr = StringCbCopy(backgroundItem->szFilename, sizeof(backgroundItem->szFilename), filename);
if (FAILED(hr)) if (FAILED(hr))
{ {
@ -605,8 +605,8 @@ OnBrowseButton(HWND hwndDlg, PDATA pData)
HRESULT hr; HRESULT hr;
TCHAR filterdesc[MAX_PATH]; TCHAR filterdesc[MAX_PATH];
TCHAR *c; TCHAR *c;
UINT sizeRemain; size_t sizeRemain;
DWORD buffersize; SIZE_T buffersize;
BOOL success; BOOL success;
hwndBackgroundList = GetDlgItem(hwndDlg, IDC_BACKGROUND_LIST); hwndBackgroundList = GetDlgItem(hwndDlg, IDC_BACKGROUND_LIST);
@ -975,12 +975,22 @@ SetWallpaper(PDATA pData)
if (SUCCEEDED(StringCchLength(pData->backgroundItems[pData->backgroundSelection].szFilename, MAX_PATH, &length))) if (SUCCEEDED(StringCchLength(pData->backgroundItems[pData->backgroundSelection].szFilename, MAX_PATH, &length)))
{ {
RegSetValueEx(regKey, TEXT("ConvertedWallpaper"), 0, REG_SZ, (BYTE*)pData->backgroundItems[pData->backgroundSelection].szFilename, (length + 1) * sizeof(TCHAR)); RegSetValueEx(regKey,
TEXT("ConvertedWallpaper"),
0,
REG_SZ,
(BYTE*)pData->backgroundItems[pData->backgroundSelection].szFilename,
(DWORD)((length + 1) * sizeof(TCHAR)));
} }
if (SUCCEEDED(StringCchLength(szWallpaper, MAX_PATH, &length))) if (SUCCEEDED(StringCchLength(szWallpaper, MAX_PATH, &length)))
{ {
RegSetValueEx(regKey, TEXT("OriginalWallpaper"), 0, REG_SZ, (BYTE *)szWallpaper, (length + 1) * sizeof(TCHAR)); RegSetValueEx(regKey,
TEXT("OriginalWallpaper"),
0,
REG_SZ,
(BYTE *)szWallpaper,
(DWORD)((length + 1) * sizeof(TCHAR)));
} }
SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, szWallpaper, SPIF_UPDATEINIFILE); SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, szWallpaper, SPIF_UPDATEINIFILE);

View file

@ -29,7 +29,7 @@ DisplayClassInstaller(
HKEY hServicesKey = NULL; HKEY hServicesKey = NULL;
HKEY hServiceKey = NULL; HKEY hServiceKey = NULL;
HKEY hDeviceSubKey = NULL; HKEY hDeviceSubKey = NULL;
DWORD disposition; DWORD disposition, cchMax, cbData;
BOOL result; BOOL result;
LONG rc; LONG rc;
HRESULT hr; HRESULT hr;
@ -96,9 +96,13 @@ DisplayClassInstaller(
goto cleanup; goto cleanup;
} }
result = SetupDiGetActualSectionToInstall( cchMax = MAX_PATH - (sizeof(_T(".SoftwareSettings")) / sizeof(TCHAR));
hInf, DriverInfoDetailData.SectionName, result = SetupDiGetActualSectionToInstall(hInf,
SectionName, MAX_PATH - _tcslen(_T(".SoftwareSettings")), NULL, NULL); DriverInfoDetailData.SectionName,
SectionName,
cchMax,
NULL,
NULL);
if (!result) if (!result)
{ {
rc = GetLastError(); rc = GetLastError();
@ -211,10 +215,15 @@ DisplayClassInstaller(
DPRINT("SetupInstallFromInfSection() failed with error 0x%lx\n", rc); DPRINT("SetupInstallFromInfSection() failed with error 0x%lx\n", rc);
goto cleanup; goto cleanup;
} }
/* Add Device Description string */ /* Add Device Description string */
rc = RegSetValueEx(hDeviceSubKey, _T("Device Description"), 0, cbData = (DWORD)(_tcslen(DriverInfoData.Description) + 1) * sizeof(TCHAR);
REG_SZ, (const BYTE*)DriverInfoData.Description, rc = RegSetValueEx(hDeviceSubKey,
(_tcslen(DriverInfoData.Description) + 1) * sizeof(TCHAR)); _T("Device Description"),
0,
REG_SZ,
(const BYTE*)DriverInfoData.Description,
cbData);
if (rc != ERROR_SUCCESS) if (rc != ERROR_SUCCESS)
{ {
DPRINT("RegSetValueEx() failed with error 0x%lx\n", rc); DPRINT("RegSetValueEx() failed with error 0x%lx\n", rc);

View file

@ -74,7 +74,7 @@ pCDevSettings_FreeString(PWCHAR *psz)
static PWSTR static PWSTR
pCDevSettings_AllocAndCopyString(const TCHAR *pszSrc) pCDevSettings_AllocAndCopyString(const TCHAR *pszSrc)
{ {
INT c; SIZE_T c;
PWSTR str; PWSTR str;
c = _tcslen(pszSrc) + 1; c = _tcslen(pszSrc) + 1;
@ -556,7 +556,7 @@ CDevSettings_GetData(IDataObject* iface,
PCWSTR pszRet = NULL; PCWSTR pszRet = NULL;
PWSTR pszBuf; PWSTR pszBuf;
PCDevSettings This = impl_from_IDataObject(iface); PCDevSettings This = impl_from_IDataObject(iface);
ZeroMemory(pmedium, ZeroMemory(pmedium,
sizeof(STGMEDIUM)); sizeof(STGMEDIUM));

View file

@ -57,7 +57,7 @@ DibLoadImage(LPTSTR lpFilename)
ZeroMemory(lpBitmap->info, sizeof(BITMAPINFO)); ZeroMemory(lpBitmap->info, sizeof(BITMAPINFO));
lpBitmap->info->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); lpBitmap->info->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
lpBitmap->info->bmiHeader.biWidth = lpBitmap->width; lpBitmap->info->bmiHeader.biWidth = lpBitmap->width;
lpBitmap->info->bmiHeader.biHeight = -lpBitmap->height; lpBitmap->info->bmiHeader.biHeight = -(INT)lpBitmap->height;
lpBitmap->info->bmiHeader.biPlanes = 1; lpBitmap->info->bmiHeader.biPlanes = 1;
lpBitmap->info->bmiHeader.biBitCount = 32; lpBitmap->info->bmiHeader.biBitCount = 32;
lpBitmap->info->bmiHeader.biCompression = BI_RGB; lpBitmap->info->bmiHeader.biCompression = BI_RGB;

View file

@ -529,7 +529,7 @@ MonSelGetMonitorRect(IN OUT PMONITORSELWND infoPtr,
{ {
RECT rc, rcClient; RECT rc, rcClient;
if (Index < 0 || Index >= infoPtr->MonitorsCount) if (Index < 0 || (UINT)Index >= infoPtr->MonitorsCount)
return -1; return -1;
if (!infoPtr->CanDisplay) if (!infoPtr->CanDisplay)
@ -1459,7 +1459,7 @@ MonitorSelWndProc(IN HWND hwnd,
Index++; Index++;
} }
if (infoPtr->SelectedMonitor < infoPtr->MonitorsCount) if (infoPtr->SelectedMonitor < (INT)infoPtr->MonitorsCount)
{ {
MonSelSetCurSelMonitor(infoPtr, MonSelSetCurSelMonitor(infoPtr,
Index, Index,

View file

@ -528,12 +528,13 @@ SetScreenSaver(HWND hwndDlg, PDATA pData)
/* Set the screensaver */ /* Set the screensaver */
if (pData->ScreenSaverItems[pData->Selection].bIsScreenSaver) if (pData->ScreenSaverItems[pData->Selection].bIsScreenSaver)
{ {
SIZE_T Length = _tcslen(pData->ScreenSaverItems[pData->Selection].szFilename) * sizeof(TCHAR);
RegSetValueEx(regKey, RegSetValueEx(regKey,
_T("SCRNSAVE.EXE"), _T("SCRNSAVE.EXE"),
0, 0,
REG_SZ, REG_SZ,
(PBYTE)pData->ScreenSaverItems[pData->Selection].szFilename, (PBYTE)pData->ScreenSaverItems[pData->Selection].szFilename,
_tcslen(pData->ScreenSaverItems[pData->Selection].szFilename) * sizeof(TCHAR)); (DWORD)Length);
SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, TRUE, 0, SPIF_UPDATEINIFILE); SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, TRUE, 0, SPIF_UPDATEINIFILE);
} }

View file

@ -146,7 +146,7 @@ AddDisplayDevice(IN PDATA pData, IN const DISPLAY_DEVICE *DisplayDevice)
LPTSTR name = NULL; LPTSTR name = NULL;
LPTSTR key = NULL; LPTSTR key = NULL;
LPTSTR devid = NULL; LPTSTR devid = NULL;
DWORD descriptionSize, nameSize, keySize, devidSize; SIZE_T descriptionSize, nameSize, keySize, devidSize;
PSETTINGS_ENTRY Current; PSETTINGS_ENTRY Current;
DWORD ResolutionsCount = 1; DWORD ResolutionsCount = 1;
DWORD i; DWORD i;