C++ conversion: fixed compilation errors for quake3 project.

This commit is contained in:
Artem Kharytoniuk
2014-05-11 00:22:27 +03:00
parent e2e32bca15
commit ff834b8b59
39 changed files with 419 additions and 405 deletions

View File

@@ -123,6 +123,7 @@
<WarningLevel>Level3</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<CompileAs>CompileAsCpp</CompileAs>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@@ -161,6 +162,7 @@
<WarningLevel>Level3</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<CompileAs>CompileAsCpp</CompileAs>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@@ -201,6 +203,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking>
<WarningLevel>Level4</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<CompileAs>CompileAsCpp</CompileAs>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@@ -236,6 +239,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking>
<WarningLevel>Level4</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<CompileAs>CompileAsCpp</CompileAs>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>

View File

@@ -279,7 +279,7 @@ qboolean IN_InitDIMouse( void ) {
}
if (!pDirectInputCreate) {
pDirectInputCreate = (long (__stdcall *)(void *,unsigned long ,struct IDirectInputA ** ,struct IUnknown *))
pDirectInputCreate = (HRESULT (__stdcall *)(HINSTANCE,DWORD ,struct IDirectInputA ** ,struct IUnknown *))
GetProcAddress(hInstDI,"DirectInputCreateA");
if (!pDirectInputCreate) {
@@ -297,7 +297,7 @@ qboolean IN_InitDIMouse( void ) {
}
// obtain an interface to the system mouse device.
hr = IDirectInput_CreateDevice(g_pdi, &GUID_SysMouse, &g_pMouse, NULL);
hr = IDirectInput_CreateDevice(g_pdi, GUID_SysMouse, &g_pMouse, NULL);
if (FAILED(hr)) {
Com_Printf ("Couldn't open DI mouse device\n");

View File

@@ -305,7 +305,7 @@ char **Sys_ListFiles( const char *directory, const char *extension, char *filter
if (!nfiles)
return NULL;
listCopy = Z_Malloc( ( nfiles + 1 ) * sizeof( *listCopy ) );
listCopy = (char**) Z_Malloc( ( nfiles + 1 ) * sizeof( *listCopy ) );
for ( i = 0 ; i < nfiles ; i++ ) {
listCopy[i] = list[i];
}
@@ -358,7 +358,7 @@ char **Sys_ListFiles( const char *directory, const char *extension, char *filter
return NULL;
}
listCopy = Z_Malloc( ( nfiles + 1 ) * sizeof( *listCopy ) );
listCopy = (char**) Z_Malloc( ( nfiles + 1 ) * sizeof( *listCopy ) );
for ( i = 0 ; i < nfiles ; i++ ) {
listCopy[i] = list[i];
}
@@ -475,8 +475,8 @@ char *Sys_GetClipboardData( void ) {
HANDLE hClipboardData;
if ( ( hClipboardData = GetClipboardData( CF_TEXT ) ) != 0 ) {
if ( ( cliptext = GlobalLock( hClipboardData ) ) != 0 ) {
data = Z_Malloc( GlobalSize( hClipboardData ) + 1 );
if ( ( cliptext = (char*) GlobalLock( hClipboardData ) ) != 0 ) {
data = (char*) Z_Malloc( GlobalSize( hClipboardData ) + 1 );
Q_strncpyz( data, cliptext, GlobalSize( hClipboardData ) );
GlobalUnlock( hClipboardData );
@@ -507,7 +507,7 @@ void Sys_UnloadDll( void *dllHandle ) {
if ( !dllHandle ) {
return;
}
if ( !FreeLibrary( dllHandle ) ) {
if ( !FreeLibrary( (HMODULE) dllHandle ) ) {
Com_Error (ERR_FATAL, "Sys_UnloadDll FreeLibrary failed");
}
}
@@ -972,7 +972,7 @@ sysEvent_t Sys_GetEvent( void ) {
int len;
len = (int)strlen( s ) + 1;
b = Z_Malloc( len );
b = (char*)Z_Malloc( len );
Q_strncpyz( b, s, len-1 );
Sys_QueEvent( 0, SE_CONSOLE, 0, 0, len, b );
}
@@ -986,7 +986,7 @@ sysEvent_t Sys_GetEvent( void ) {
// copy out to a seperate buffer for qeueing
// the readcount stepahead is for SOCKS support
len = sizeof( netadr_t ) + netmsg.cursize - netmsg.readcount;
buf = Z_Malloc( len );
buf = (netadr_t*) Z_Malloc( len );
*buf = adr;
memcpy( buf+1, &netmsg.data[netmsg.readcount], netmsg.cursize - netmsg.readcount );
Sys_QueEvent( 0, SE_PACKET, 0, 0, len, buf );

View File

@@ -198,7 +198,7 @@ qboolean Sys_StringToSockaddr( const char *s, struct sockaddr *sadr ) {
*(int *)&((struct sockaddr_in *)sadr)->sin_addr = inet_addr(s);
} else {
if( ( h = gethostbyname( s ) ) == 0 ) {
return 0;
return (qboolean) 0;
}
*(int *)&((struct sockaddr_in *)sadr)->sin_addr = *(int *)h->h_addr_list[0];
}
@@ -261,7 +261,7 @@ qboolean Sys_GetPacket( netadr_t *net_from, msg_t *net_message ) {
fromlen = sizeof(from);
recvfromCount++; // performance check
ret = recvfrom( net_socket, net_message->data, net_message->maxsize, 0, (struct sockaddr *)&from, &fromlen );
ret = recvfrom( net_socket, (char*) net_message->data, net_message->maxsize, 0, (struct sockaddr *)&from, &fromlen );
if (ret == SOCKET_ERROR)
{
err = WSAGetLastError();
@@ -354,7 +354,7 @@ void Sys_SendPacket( int length, const void *data, netadr_t to ) {
ret = sendto( net_socket, socksBuf, length+10, 0, &socksRelayAddr, sizeof(socksRelayAddr) );
}
else {
ret = sendto( net_socket, data, length, 0, &addr, sizeof(addr) );
ret = sendto( net_socket, (const char*) data, length, 0, &addr, sizeof(addr) );
}
if( ret == SOCKET_ERROR ) {
int err = WSAGetLastError();
@@ -488,7 +488,7 @@ int NET_IPSocket( char *net_interface, int port ) {
}
// make it non-blocking
if( ioctlsocket( newsocket, FIONBIO, &_true ) == SOCKET_ERROR ) {
if( ioctlsocket( newsocket, FIONBIO, &(u_long&)_true ) == SOCKET_ERROR ) {
Com_Printf( "WARNING: UDP_OpenSocket: ioctl FIONBIO: %s\n", NET_ErrorString() );
return 0;
}
@@ -515,7 +515,7 @@ int NET_IPSocket( char *net_interface, int port ) {
address.sin_family = AF_INET;
if( bind( newsocket, (void *)&address, sizeof(address) ) == SOCKET_ERROR ) {
if( bind( newsocket, (const sockaddr*) (void *)&address, sizeof(address) ) == SOCKET_ERROR ) {
Com_Printf( "WARNING: UDP_OpenSocket: bind: %s\n", NET_ErrorString() );
closesocket( newsocket );
return 0;
@@ -590,14 +590,14 @@ void NET_OpenSocks( int port ) {
if ( rfc1929 ) {
buf[2] = 2; // method #2 - method id #02: username/password
}
if ( send( socks_socket, buf, len, 0 ) == SOCKET_ERROR ) {
if ( send( socks_socket, (const char*) buf, len, 0 ) == SOCKET_ERROR ) {
err = WSAGetLastError();
Com_Printf( "NET_OpenSocks: send: %s\n", NET_ErrorString() );
return;
}
// get the response
len = recv( socks_socket, buf, 64, 0 );
len = recv( socks_socket, (char*) buf, 64, 0 );
if ( len == SOCKET_ERROR ) {
err = WSAGetLastError();
Com_Printf( "NET_OpenSocks: recv: %s\n", NET_ErrorString() );
@@ -637,14 +637,14 @@ void NET_OpenSocks( int port ) {
}
// send it
if ( send( socks_socket, buf, 3 + ulen + plen, 0 ) == SOCKET_ERROR ) {
if ( send( socks_socket, (const char*) buf, 3 + ulen + plen, 0 ) == SOCKET_ERROR ) {
err = WSAGetLastError();
Com_Printf( "NET_OpenSocks: send: %s\n", NET_ErrorString() );
return;
}
// get the response
len = recv( socks_socket, buf, 64, 0 );
len = recv( socks_socket, (char*) buf, 64, 0 );
if ( len == SOCKET_ERROR ) {
err = WSAGetLastError();
Com_Printf( "NET_OpenSocks: recv: %s\n", NET_ErrorString() );
@@ -667,14 +667,14 @@ void NET_OpenSocks( int port ) {
buf[3] = 1; // address type: IPV4
*(int *)&buf[4] = INADDR_ANY;
*(short *)&buf[8] = htons( (short)port ); // port
if ( send( socks_socket, buf, 10, 0 ) == SOCKET_ERROR ) {
if ( send( socks_socket, (const char*) buf, 10, 0 ) == SOCKET_ERROR ) {
err = WSAGetLastError();
Com_Printf( "NET_OpenSocks: send: %s\n", NET_ErrorString() );
return;
}
// get the response
len = recv( socks_socket, buf, 64, 0 );
len = recv( socks_socket, (char*) buf, 64, 0 );
if( len == SOCKET_ERROR ) {
err = WSAGetLastError();
Com_Printf( "NET_OpenSocks: recv: %s\n", NET_ErrorString() );
@@ -799,7 +799,7 @@ int NET_IPXSocket( int port ) {
}
// make it non-blocking
if( ioctlsocket( newsocket, FIONBIO, &_true ) == SOCKET_ERROR ) {
if( ioctlsocket( newsocket, FIONBIO, &(u_long&)_true ) == SOCKET_ERROR ) {
Com_Printf( "WARNING: IPX_Socket: ioctl FIONBIO: %s\n", NET_ErrorString() );
return 0;
}
@@ -820,7 +820,7 @@ int NET_IPXSocket( int port ) {
address.sa_socket = htons( (short)port );
}
if( bind( newsocket, (void *)&address, sizeof(address) ) == SOCKET_ERROR ) {
if( bind( newsocket, (const sockaddr*) (void *)&address, sizeof(address) ) == SOCKET_ERROR ) {
Com_Printf( "WARNING: IPX_Socket: bind: %s\n", NET_ErrorString() );
closesocket( newsocket );
return 0;

View File

@@ -22,6 +22,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include <float.h>
#include "../client/snd_local.h"
#define CINTERFACE
#include "win_local.h"
HRESULT (WINAPI *pDirectSoundCreate)(GUID FAR *lpGUID, LPDIRECTSOUND FAR *lplpDS, IUnknown FAR *pUnkOuter);
@@ -117,7 +118,7 @@ Returns false if failed
qboolean SNDDMA_Init(void) {
memset ((void *)&dma, 0, sizeof (dma));
dsound_init = 0;
dsound_init = (qboolean) 0;
CoInitialize(NULL);
@@ -160,9 +161,9 @@ int SNDDMA_InitDS ()
use8 = 1;
// Create IDirectSound using the primary sound device
if( FAILED( hresult = CoCreateInstance(&CLSID_DirectSound8, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectSound8, (void **)&pDS))) {
if( FAILED( hresult = CoCreateInstance(CLSID_DirectSound8, NULL, CLSCTX_INPROC_SERVER, IID_IDirectSound8, (void **)&pDS))) {
use8 = 0;
if( FAILED( hresult = CoCreateInstance(&CLSID_DirectSound, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectSound, (void **)&pDS))) {
if( FAILED( hresult = CoCreateInstance(CLSID_DirectSound, NULL, CLSCTX_INPROC_SERVER, IID_IDirectSound, (void **)&pDS))) {
Com_Printf ("failed\n");
SNDDMA_Shutdown ();
return qfalse;
@@ -331,8 +332,8 @@ void SNDDMA_BeginPainting( void ) {
reps = 0;
dma.buffer = NULL;
while ((hresult = pDSBuf->lpVtbl->Lock(pDSBuf, 0, gSndBufSize, &pbuf, &locksize,
&pbuf2, &dwSize2, 0)) != DS_OK)
while ((hresult = pDSBuf->lpVtbl->Lock(pDSBuf, 0, gSndBufSize, (LPVOID*) &pbuf, &locksize,
(LPVOID*) &pbuf2, &dwSize2, 0)) != DS_OK)
{
if (hresult != DSERR_BUFFERLOST)
{

View File

@@ -182,7 +182,7 @@ static LRESULT WINAPI ConWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lP
case WM_TIMER:
if ( wParam == 1 )
{
s_timePolarity = !s_timePolarity;
s_timePolarity = (qboolean) !s_timePolarity;
if ( s_wcd.hwndErrorBox )
{
InvalidateRect( s_wcd.hwndErrorBox, NULL, FALSE );
@@ -248,7 +248,7 @@ void Sys_CreateConsole( void )
wc.hInstance = g_wv.hInstance;
wc.hIcon = LoadIcon( g_wv.hInstance, MAKEINTRESOURCE(IDI_ICON1));
wc.hCursor = LoadCursor (NULL,IDC_ARROW);
wc.hbrBackground = (void *)COLOR_WINDOW;
wc.hbrBackground = (HBRUSH) (void *)COLOR_WINDOW;
wc.lpszMenuName = 0;
wc.lpszClassName = DEDCLASS;

View File

@@ -86,7 +86,7 @@ VID_AppActivate
*/
static void VID_AppActivate(BOOL fActive, BOOL minimize)
{
g_wv.isMinimized = minimize;
g_wv.isMinimized = (qboolean) minimize;
Com_DPrintf("VID_AppActivate: %i\n", fActive );
@@ -280,7 +280,7 @@ LONG WINAPI MainWndProc (
else
{
Sys_QueEvent( g_wv.sysMsgTime, SE_KEY, K_MWHEELUP, flip, 0, NULL );
flip = !flip;
flip = (qboolean) !flip;
}
}
}
@@ -296,7 +296,7 @@ LONG WINAPI MainWndProc (
else
{
Sys_QueEvent( g_wv.sysMsgTime, SE_KEY, K_MWHEELDOWN, flip, 0, NULL );
flip = !flip;
flip = (qboolean) !flip;
}
}
}