Commit a56fcef7 authored by Alexandre Julliard's avatar Alexandre Julliard

dplayx: Use nameless unions/structs.

parent aa9aace5
...@@ -32,8 +32,6 @@ ...@@ -32,8 +32,6 @@
#include <stdarg.h> #include <stdarg.h>
#include <string.h> #include <string.h>
#define NONAMELESSUNION
#include "wine/debug.h" #include "wine/debug.h"
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
...@@ -562,20 +560,20 @@ static void DPLAYX_CopyConnStructA( LPDPLCONNECTION dest, const DPLCONNECTION *s ...@@ -562,20 +560,20 @@ static void DPLAYX_CopyConnStructA( LPDPLCONNECTION dest, const DPLCONNECTION *s
*dest->lpSessionDesc = *src->lpSessionDesc; *dest->lpSessionDesc = *src->lpSessionDesc;
/* Session names may or may not exist */ /* Session names may or may not exist */
if( src->lpSessionDesc->u1.lpszSessionNameA ) if( src->lpSessionDesc->lpszSessionNameA )
{ {
strcpy( (LPSTR)lpStartOfFreeSpace, src->lpSessionDesc->u1.lpszSessionNameA ); strcpy( (LPSTR)lpStartOfFreeSpace, src->lpSessionDesc->lpszSessionNameA );
dest->lpSessionDesc->u1.lpszSessionNameA = (LPSTR)lpStartOfFreeSpace; dest->lpSessionDesc->lpszSessionNameA = (LPSTR)lpStartOfFreeSpace;
lpStartOfFreeSpace += lpStartOfFreeSpace +=
strlen( dest->lpSessionDesc->u1.lpszSessionNameA ) + 1; strlen( dest->lpSessionDesc->lpszSessionNameA ) + 1;
} }
if( src->lpSessionDesc->u2.lpszPasswordA ) if( src->lpSessionDesc->lpszPasswordA )
{ {
strcpy( (LPSTR)lpStartOfFreeSpace, src->lpSessionDesc->u2.lpszPasswordA ); strcpy( (LPSTR)lpStartOfFreeSpace, src->lpSessionDesc->lpszPasswordA );
dest->lpSessionDesc->u2.lpszPasswordA = (LPSTR)lpStartOfFreeSpace; dest->lpSessionDesc->lpszPasswordA = (LPSTR)lpStartOfFreeSpace;
lpStartOfFreeSpace += lpStartOfFreeSpace +=
strlen( dest->lpSessionDesc->u2.lpszPasswordA ) + 1; strlen( dest->lpSessionDesc->lpszPasswordA ) + 1;
} }
} }
...@@ -586,20 +584,20 @@ static void DPLAYX_CopyConnStructA( LPDPLCONNECTION dest, const DPLCONNECTION *s ...@@ -586,20 +584,20 @@ static void DPLAYX_CopyConnStructA( LPDPLCONNECTION dest, const DPLCONNECTION *s
lpStartOfFreeSpace += sizeof( DPNAME ); lpStartOfFreeSpace += sizeof( DPNAME );
*dest->lpPlayerName = *src->lpPlayerName; *dest->lpPlayerName = *src->lpPlayerName;
if( src->lpPlayerName->u1.lpszShortNameA ) if( src->lpPlayerName->lpszShortNameA )
{ {
strcpy( (LPSTR)lpStartOfFreeSpace, src->lpPlayerName->u1.lpszShortNameA ); strcpy( (LPSTR)lpStartOfFreeSpace, src->lpPlayerName->lpszShortNameA );
dest->lpPlayerName->u1.lpszShortNameA = (LPSTR)lpStartOfFreeSpace; dest->lpPlayerName->lpszShortNameA = (LPSTR)lpStartOfFreeSpace;
lpStartOfFreeSpace += lpStartOfFreeSpace +=
strlen( dest->lpPlayerName->u1.lpszShortNameA ) + 1; strlen( dest->lpPlayerName->lpszShortNameA ) + 1;
} }
if( src->lpPlayerName->u2.lpszLongNameA ) if( src->lpPlayerName->lpszLongNameA )
{ {
strcpy( (LPSTR)lpStartOfFreeSpace, src->lpPlayerName->u2.lpszLongNameA ); strcpy( (LPSTR)lpStartOfFreeSpace, src->lpPlayerName->lpszLongNameA );
dest->lpPlayerName->u2.lpszLongNameA = (LPSTR)lpStartOfFreeSpace; dest->lpPlayerName->lpszLongNameA = (LPSTR)lpStartOfFreeSpace;
lpStartOfFreeSpace += lpStartOfFreeSpace +=
strlen( (LPSTR)dest->lpPlayerName->u2.lpszLongName ) + 1 ; strlen( (LPSTR)dest->lpPlayerName->lpszLongName ) + 1 ;
} }
} }
...@@ -630,20 +628,20 @@ static void DPLAYX_CopyConnStructW( LPDPLCONNECTION dest, const DPLCONNECTION *s ...@@ -630,20 +628,20 @@ static void DPLAYX_CopyConnStructW( LPDPLCONNECTION dest, const DPLCONNECTION *s
*dest->lpSessionDesc = *src->lpSessionDesc; *dest->lpSessionDesc = *src->lpSessionDesc;
/* Session names may or may not exist */ /* Session names may or may not exist */
if( src->lpSessionDesc->u1.lpszSessionName ) if( src->lpSessionDesc->lpszSessionName )
{ {
lstrcpyW( (LPWSTR)lpStartOfFreeSpace, src->lpSessionDesc->u1.lpszSessionName ); lstrcpyW( (LPWSTR)lpStartOfFreeSpace, src->lpSessionDesc->lpszSessionName );
dest->lpSessionDesc->u1.lpszSessionName = (LPWSTR)lpStartOfFreeSpace; dest->lpSessionDesc->lpszSessionName = (LPWSTR)lpStartOfFreeSpace;
lpStartOfFreeSpace += sizeof(WCHAR) * lpStartOfFreeSpace += sizeof(WCHAR) *
( lstrlenW( dest->lpSessionDesc->u1.lpszSessionName ) + 1 ); ( lstrlenW( dest->lpSessionDesc->lpszSessionName ) + 1 );
} }
if( src->lpSessionDesc->u2.lpszPassword ) if( src->lpSessionDesc->lpszPassword )
{ {
lstrcpyW( (LPWSTR)lpStartOfFreeSpace, src->lpSessionDesc->u2.lpszPassword ); lstrcpyW( (LPWSTR)lpStartOfFreeSpace, src->lpSessionDesc->lpszPassword );
dest->lpSessionDesc->u2.lpszPassword = (LPWSTR)lpStartOfFreeSpace; dest->lpSessionDesc->lpszPassword = (LPWSTR)lpStartOfFreeSpace;
lpStartOfFreeSpace += sizeof(WCHAR) * lpStartOfFreeSpace += sizeof(WCHAR) *
( lstrlenW( dest->lpSessionDesc->u2.lpszPassword ) + 1 ); ( lstrlenW( dest->lpSessionDesc->lpszPassword ) + 1 );
} }
} }
...@@ -654,20 +652,20 @@ static void DPLAYX_CopyConnStructW( LPDPLCONNECTION dest, const DPLCONNECTION *s ...@@ -654,20 +652,20 @@ static void DPLAYX_CopyConnStructW( LPDPLCONNECTION dest, const DPLCONNECTION *s
lpStartOfFreeSpace += sizeof( DPNAME ); lpStartOfFreeSpace += sizeof( DPNAME );
*dest->lpPlayerName = *src->lpPlayerName; *dest->lpPlayerName = *src->lpPlayerName;
if( src->lpPlayerName->u1.lpszShortName ) if( src->lpPlayerName->lpszShortName )
{ {
lstrcpyW( (LPWSTR)lpStartOfFreeSpace, src->lpPlayerName->u1.lpszShortName ); lstrcpyW( (LPWSTR)lpStartOfFreeSpace, src->lpPlayerName->lpszShortName );
dest->lpPlayerName->u1.lpszShortName = (LPWSTR)lpStartOfFreeSpace; dest->lpPlayerName->lpszShortName = (LPWSTR)lpStartOfFreeSpace;
lpStartOfFreeSpace += sizeof(WCHAR) * lpStartOfFreeSpace += sizeof(WCHAR) *
( lstrlenW( dest->lpPlayerName->u1.lpszShortName ) + 1 ); ( lstrlenW( dest->lpPlayerName->lpszShortName ) + 1 );
} }
if( src->lpPlayerName->u2.lpszLongName ) if( src->lpPlayerName->lpszLongName )
{ {
lstrcpyW( (LPWSTR)lpStartOfFreeSpace, src->lpPlayerName->u2.lpszLongName ); lstrcpyW( (LPWSTR)lpStartOfFreeSpace, src->lpPlayerName->lpszLongName );
dest->lpPlayerName->u2.lpszLongName = (LPWSTR)lpStartOfFreeSpace; dest->lpPlayerName->lpszLongName = (LPWSTR)lpStartOfFreeSpace;
lpStartOfFreeSpace += sizeof(WCHAR) * lpStartOfFreeSpace += sizeof(WCHAR) *
( lstrlenW( dest->lpPlayerName->u2.lpszLongName ) + 1 ); ( lstrlenW( dest->lpPlayerName->lpszLongName ) + 1 );
} }
} }
...@@ -697,14 +695,14 @@ static DWORD DPLAYX_SizeOfLobbyDataA( const DPLCONNECTION *lpConn ) ...@@ -697,14 +695,14 @@ static DWORD DPLAYX_SizeOfLobbyDataA( const DPLCONNECTION *lpConn )
{ {
dwTotalSize += sizeof( DPSESSIONDESC2 ); dwTotalSize += sizeof( DPSESSIONDESC2 );
if( lpConn->lpSessionDesc->u1.lpszSessionNameA ) if( lpConn->lpSessionDesc->lpszSessionNameA )
{ {
dwTotalSize += strlen( lpConn->lpSessionDesc->u1.lpszSessionNameA ) + 1; dwTotalSize += strlen( lpConn->lpSessionDesc->lpszSessionNameA ) + 1;
} }
if( lpConn->lpSessionDesc->u2.lpszPasswordA ) if( lpConn->lpSessionDesc->lpszPasswordA )
{ {
dwTotalSize += strlen( lpConn->lpSessionDesc->u2.lpszPasswordA ) + 1; dwTotalSize += strlen( lpConn->lpSessionDesc->lpszPasswordA ) + 1;
} }
} }
...@@ -712,14 +710,14 @@ static DWORD DPLAYX_SizeOfLobbyDataA( const DPLCONNECTION *lpConn ) ...@@ -712,14 +710,14 @@ static DWORD DPLAYX_SizeOfLobbyDataA( const DPLCONNECTION *lpConn )
{ {
dwTotalSize += sizeof( DPNAME ); dwTotalSize += sizeof( DPNAME );
if( lpConn->lpPlayerName->u1.lpszShortNameA ) if( lpConn->lpPlayerName->lpszShortNameA )
{ {
dwTotalSize += strlen( lpConn->lpPlayerName->u1.lpszShortNameA ) + 1; dwTotalSize += strlen( lpConn->lpPlayerName->lpszShortNameA ) + 1;
} }
if( lpConn->lpPlayerName->u2.lpszLongNameA ) if( lpConn->lpPlayerName->lpszLongNameA )
{ {
dwTotalSize += strlen( lpConn->lpPlayerName->u2.lpszLongNameA ) + 1; dwTotalSize += strlen( lpConn->lpPlayerName->lpszLongNameA ) + 1;
} }
} }
...@@ -744,16 +742,16 @@ static DWORD DPLAYX_SizeOfLobbyDataW( const DPLCONNECTION *lpConn ) ...@@ -744,16 +742,16 @@ static DWORD DPLAYX_SizeOfLobbyDataW( const DPLCONNECTION *lpConn )
{ {
dwTotalSize += sizeof( DPSESSIONDESC2 ); dwTotalSize += sizeof( DPSESSIONDESC2 );
if( lpConn->lpSessionDesc->u1.lpszSessionName ) if( lpConn->lpSessionDesc->lpszSessionName )
{ {
dwTotalSize += sizeof( WCHAR ) * dwTotalSize += sizeof( WCHAR ) *
( lstrlenW( lpConn->lpSessionDesc->u1.lpszSessionName ) + 1 ); ( lstrlenW( lpConn->lpSessionDesc->lpszSessionName ) + 1 );
} }
if( lpConn->lpSessionDesc->u2.lpszPassword ) if( lpConn->lpSessionDesc->lpszPassword )
{ {
dwTotalSize += sizeof( WCHAR ) * dwTotalSize += sizeof( WCHAR ) *
( lstrlenW( lpConn->lpSessionDesc->u2.lpszPassword ) + 1 ); ( lstrlenW( lpConn->lpSessionDesc->lpszPassword ) + 1 );
} }
} }
...@@ -761,16 +759,16 @@ static DWORD DPLAYX_SizeOfLobbyDataW( const DPLCONNECTION *lpConn ) ...@@ -761,16 +759,16 @@ static DWORD DPLAYX_SizeOfLobbyDataW( const DPLCONNECTION *lpConn )
{ {
dwTotalSize += sizeof( DPNAME ); dwTotalSize += sizeof( DPNAME );
if( lpConn->lpPlayerName->u1.lpszShortName ) if( lpConn->lpPlayerName->lpszShortName )
{ {
dwTotalSize += sizeof( WCHAR ) * dwTotalSize += sizeof( WCHAR ) *
( lstrlenW( lpConn->lpPlayerName->u1.lpszShortName ) + 1 ); ( lstrlenW( lpConn->lpPlayerName->lpszShortName ) + 1 );
} }
if( lpConn->lpPlayerName->u2.lpszLongName ) if( lpConn->lpPlayerName->lpszLongName )
{ {
dwTotalSize += sizeof( WCHAR ) * dwTotalSize += sizeof( WCHAR ) *
( lstrlenW( lpConn->lpPlayerName->u2.lpszLongName ) + 1 ); ( lstrlenW( lpConn->lpPlayerName->lpszLongName ) + 1 );
} }
} }
......
...@@ -20,8 +20,6 @@ ...@@ -20,8 +20,6 @@
#include <string.h> #include <string.h>
#define COBJMACROS #define COBJMACROS
#define NONAMELESSUNION
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
#include "winerror.h" #include "winerror.h"
...@@ -954,9 +952,9 @@ static HRESULT WINAPI IDirectPlayLobby3AImpl_EnumLocalApplications( IDirectPlayL ...@@ -954,9 +952,9 @@ static HRESULT WINAPI IDirectPlayLobby3AImpl_EnumLocalApplications( IDirectPlayL
CLSIDFromString( buff, &serviceProviderGUID ); CLSIDFromString( buff, &serviceProviderGUID );
/* FIXME: Have I got a memory leak on the serviceProviderGUID? */ /* FIXME: Have I got a memory leak on the serviceProviderGUID? */
dplAppInfo.dwSize = sizeof( dplAppInfo ); dplAppInfo.dwSize = sizeof( dplAppInfo );
dplAppInfo.guidApplication = serviceProviderGUID; dplAppInfo.guidApplication = serviceProviderGUID;
dplAppInfo.u.lpszAppNameA = subKeyName; dplAppInfo.lpszAppNameA = subKeyName;
EnterCriticalSection( &This->lock ); EnterCriticalSection( &This->lock );
......
...@@ -22,8 +22,6 @@ ...@@ -22,8 +22,6 @@
#include <stdarg.h> #include <stdarg.h>
#include <string.h> #include <string.h>
#define NONAMELESSUNION
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
#include "winnls.h" #include "winnls.h"
...@@ -130,10 +128,10 @@ void NS_AddRemoteComputerAsNameServer( LPCVOID lpcNSAddrHdr ...@@ -130,10 +128,10 @@ void NS_AddRemoteComputerAsNameServer( LPCVOID lpcNSAddrHdr
*lpCacheNode->data = lpcMsg->sd; *lpCacheNode->data = lpcMsg->sd;
len = WideCharToMultiByte( CP_ACP, 0, (LPCWSTR)(lpcMsg+1), -1, NULL, 0, NULL, NULL ); len = WideCharToMultiByte( CP_ACP, 0, (LPCWSTR)(lpcMsg+1), -1, NULL, 0, NULL, NULL );
if ((lpCacheNode->data->u1.lpszSessionNameA = HeapAlloc( GetProcessHeap(), 0, len ))) if ((lpCacheNode->data->lpszSessionNameA = HeapAlloc( GetProcessHeap(), 0, len )))
{ {
WideCharToMultiByte( CP_ACP, 0, (LPCWSTR)(lpcMsg+1), -1, WideCharToMultiByte( CP_ACP, 0, (LPCWSTR)(lpcMsg+1), -1,
lpCacheNode->data->u1.lpszSessionNameA, len, NULL, NULL ); lpCacheNode->data->lpszSessionNameA, len, NULL, NULL );
} }
lpCacheNode->dwTime = timeGetTime(); lpCacheNode->dwTime = timeGetTime();
...@@ -367,7 +365,7 @@ void NS_ReplyToEnumSessionsRequest( const void *lpcMsg, void **lplpReplyData, DW ...@@ -367,7 +365,7 @@ void NS_ReplyToEnumSessionsRequest( const void *lpcMsg, void **lplpReplyData, DW
FIXME( ": few fixed + need to check request for response, might need UNICODE input ability.\n" ); FIXME( ": few fixed + need to check request for response, might need UNICODE input ability.\n" );
dwVariableLen = MultiByteToWideChar( CP_ACP, 0, dwVariableLen = MultiByteToWideChar( CP_ACP, 0,
lpDP->dp2->lpSessionDesc->u1.lpszSessionNameA, lpDP->dp2->lpSessionDesc->lpszSessionNameA,
-1, NULL, 0 ); -1, NULL, 0 );
dwVariableSize = dwVariableLen * sizeof( WCHAR ); dwVariableSize = dwVariableLen * sizeof( WCHAR );
...@@ -386,6 +384,6 @@ void NS_ReplyToEnumSessionsRequest( const void *lpcMsg, void **lplpReplyData, DW ...@@ -386,6 +384,6 @@ void NS_ReplyToEnumSessionsRequest( const void *lpcMsg, void **lplpReplyData, DW
CopyMemory( &rmsg->sd, lpDP->dp2->lpSessionDesc, CopyMemory( &rmsg->sd, lpDP->dp2->lpSessionDesc,
lpDP->dp2->lpSessionDesc->dwSize ); lpDP->dp2->lpSessionDesc->dwSize );
rmsg->dwUnknown = 0x0000005c; rmsg->dwUnknown = 0x0000005c;
MultiByteToWideChar( CP_ACP, 0, lpDP->dp2->lpSessionDesc->u1.lpszSessionNameA, -1, MultiByteToWideChar( CP_ACP, 0, lpDP->dp2->lpSessionDesc->lpszSessionNameA, -1,
(LPWSTR)(rmsg+1), dwVariableLen ); (LPWSTR)(rmsg+1), dwVariableLen );
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment