From a8126f3f1e2e5a07e87aa949816d78cc4378fece Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Mon, 1 Oct 2018 00:23:02 +0100 Subject: [PATCH] [DPLAYX] Sync with Wine Staging 3.17. CORE-15127 --- dll/directx/wine/dplayx/dplay.c | 12 ++++++------ dll/directx/wine/dplayx/dplayx_global.c | 4 ++-- dll/directx/wine/dplayx/dplobby.c | 6 +++--- media/doc/README.WINE | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/dll/directx/wine/dplayx/dplay.c b/dll/directx/wine/dplayx/dplay.c index fde068138e5..65c7e4df5d5 100644 --- a/dll/directx/wine/dplayx/dplay.c +++ b/dll/directx/wine/dplayx/dplay.c @@ -4335,7 +4335,7 @@ static HRESULT WINAPI IDirectPlay4AImpl_EnumConnections( IDirectPlay4A *iface, RegCloseKey(hkServiceProvider); /* FIXME: Check return types to ensure we're interpreting data right */ - MultiByteToWideChar( CP_ACP, 0, returnBuffer, -1, buff, sizeof(buff)/sizeof(WCHAR) ); + MultiByteToWideChar( CP_ACP, 0, returnBuffer, -1, buff, ARRAY_SIZE( buff )); CLSIDFromString( buff, &serviceProviderGUID ); /* FIXME: Have I got a memory leak on the serviceProviderGUID? */ @@ -4433,7 +4433,7 @@ static HRESULT WINAPI IDirectPlay4AImpl_EnumConnections( IDirectPlay4A *iface, RegCloseKey(hkServiceProvider); /* FIXME: Check return types to ensure we're interpreting data right */ - MultiByteToWideChar( CP_ACP, 0, returnBuffer, -1, buff, sizeof(buff)/sizeof(WCHAR) ); + MultiByteToWideChar( CP_ACP, 0, returnBuffer, -1, buff, ARRAY_SIZE( buff )); CLSIDFromString( buff, &serviceProviderGUID ); /* FIXME: Have I got a memory leak on the serviceProviderGUID? */ @@ -4682,7 +4682,7 @@ static HMODULE DP_LoadSP( LPCGUID lpcGuid, LPSPINITDATA lpSpData, LPBOOL lpbIsDp } /* FIXME: Check return types to ensure we're interpreting data right */ - MultiByteToWideChar( CP_ACP, 0, returnBuffer, -1, buff, sizeof(buff)/sizeof(WCHAR) ); + MultiByteToWideChar( CP_ACP, 0, returnBuffer, -1, buff, ARRAY_SIZE( buff )); CLSIDFromString( buff, &serviceProviderGUID ); /* FIXME: Have I got a memory leak on the serviceProviderGUID? */ @@ -5811,7 +5811,7 @@ static HRESULT DirectPlayEnumerateAW(LPDPENUMDPCALLBACKA lpEnumCallbackA, dwIndex = 0; do { - sizeOfSubKeyName = sizeof(subKeyName) / sizeof(WCHAR); + sizeOfSubKeyName = ARRAY_SIZE(subKeyName); ret_value = RegEnumKeyW(hkResult, dwIndex, subKeyName, sizeOfSubKeyName); dwIndex++; } @@ -5836,8 +5836,8 @@ static HRESULT DirectPlayEnumerateAW(LPDPENUMDPCALLBACKA lpEnumCallbackA, HKEY hkServiceProvider; WCHAR guidKeyContent[(2 * 16) + 1 + 6 /* This corresponds to '{....-..-..-..-......}' */ ]; DWORD sizeOfGuidKeyContent = sizeof(guidKeyContent); - - sizeOfSubKeyName = sizeof(subKeyName) / sizeof(WCHAR); + + sizeOfSubKeyName = ARRAY_SIZE(subKeyName); ret_value = RegEnumKeyExW(hkResult, dwIndex, subKeyName, &sizeOfSubKeyName, NULL, NULL, NULL, &filetime); if (ret_value == ERROR_NO_MORE_ITEMS) diff --git a/dll/directx/wine/dplayx/dplayx_global.c b/dll/directx/wine/dplayx/dplayx_global.c index 14c53a0c8d4..bc087c8b33b 100644 --- a/dll/directx/wine/dplayx/dplayx_global.c +++ b/dll/directx/wine/dplayx/dplayx_global.c @@ -120,9 +120,9 @@ static LPVOID DPLAYX_PrivHeapAlloc( DWORD flags, DWORD size ) /* Find blank area */ uBlockUsed = 0; - while( lpMemArea[ uBlockUsed ].used && uBlockUsed <= dwMaxBlock ) { uBlockUsed++; } + while( uBlockUsed < dwMaxBlock && lpMemArea[ uBlockUsed ].used ) { uBlockUsed++; } - if( uBlockUsed <= dwMaxBlock ) + if( uBlockUsed < dwMaxBlock ) { /* Set the area used */ lpMemArea[ uBlockUsed ].used = TRUE; diff --git a/dll/directx/wine/dplayx/dplobby.c b/dll/directx/wine/dplayx/dplobby.c index 944fea9ec64..30d76aa16d1 100644 --- a/dll/directx/wine/dplayx/dplobby.c +++ b/dll/directx/wine/dplayx/dplobby.c @@ -782,7 +782,7 @@ static HRESULT WINAPI IDirectPlayLobby3AImpl_EnumAddressTypes( IDirectPlayLobby3 } /* FIXME: Check return types to ensure we're interpreting data right */ - MultiByteToWideChar( CP_ACP, 0, returnBuffer, -1, buff, sizeof(buff)/sizeof(WCHAR) ); + MultiByteToWideChar( CP_ACP, 0, returnBuffer, -1, buff, ARRAY_SIZE( buff )); CLSIDFromString( buff, &serviceProviderGUID ); /* FIXME: Have I got a memory leak on the serviceProviderGUID? */ @@ -809,7 +809,7 @@ static HRESULT WINAPI IDirectPlayLobby3AImpl_EnumAddressTypes( IDirectPlayLobby3 TRACE( "Found Address Type GUID %s\n", atSubKey ); /* FIXME: Check return types to ensure we're interpreting data right */ - MultiByteToWideChar( CP_ACP, 0, atSubKey, -1, buff, sizeof(buff)/sizeof(WCHAR) ); + MultiByteToWideChar( CP_ACP, 0, atSubKey, -1, buff, ARRAY_SIZE( buff )); CLSIDFromString( buff, &serviceProviderGUID ); /* FIXME: Have I got a memory leak on the serviceProviderGUID? */ @@ -950,7 +950,7 @@ static HRESULT WINAPI IDirectPlayLobby3AImpl_EnumLocalApplications( IDirectPlayL } /* FIXME: Check return types to ensure we're interpreting data right */ - MultiByteToWideChar( CP_ACP, 0, returnBuffer, -1, buff, sizeof(buff)/sizeof(WCHAR) ); + MultiByteToWideChar( CP_ACP, 0, returnBuffer, -1, buff, ARRAY_SIZE( buff )); CLSIDFromString( buff, &serviceProviderGUID ); /* FIXME: Have I got a memory leak on the serviceProviderGUID? */ diff --git a/media/doc/README.WINE b/media/doc/README.WINE index a0bda6e3b50..b51b4082cc8 100644 --- a/media/doc/README.WINE +++ b/media/doc/README.WINE @@ -34,7 +34,7 @@ reactos/dll/directx/wine/dinput # Synced to WineStaging-3.17 reactos/dll/directx/wine/dinput8 # Synced to WineStaging-3.3 reactos/dll/directx/wine/dmusic # Synced to WineStaging-3.17 reactos/dll/directx/wine/dplay # Synced to WineStaging-3.3 -reactos/dll/directx/wine/dplayx # Synced to WineStaging-3.3 +reactos/dll/directx/wine/dplayx # Synced to WineStaging-3.17 reactos/dll/directx/wine/dsound # Synced to Wine-1.3.29 reactos/dll/directx/wine/dxdiagn # Synced to WineStaging-3.3 reactos/dll/directx/wine/msdmo # Synced to WineStaging-3.9