Skip to content

Commit 3d4b61a

Browse files
Fixed some compile warnings.
1 parent 18c1d65 commit 3d4b61a

File tree

5 files changed

+25
-11
lines changed

5 files changed

+25
-11
lines changed

sockets/extra/CLuaArgument.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616
*
1717
*********************************************************/
1818

19+
#ifdef WIN32
20+
#pragma warning (disable : 4996) // DISABLE: 'strcpy': This function or variable may be unsafe.
21+
#endif
22+
1923
#include "CLuaArgument.h"
2024
#include <assert.h>
2125
#include <cstring>

sockets/extra/CLuaArguments.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ bool CLuaArguments::Call ( lua_State* luaVM, const char* szFunction ) const
102102
int iret = lua_pcall ( luaVM, m_Arguments.size (), 0, 0 ) ;
103103
if ( iret == LUA_ERRRUN || iret == LUA_ERRMEM )
104104
{
105-
const char* szRes = lua_tostring( luaVM, -1 );
105+
//const char* szRes = lua_tostring( luaVM, -1 );
106106
return false; // the function call failed
107107
}
108108

sockets/ml_sockets.cpp

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,17 @@ MTAEXPORT bool InitModule ( ILuaModuleManager10 *pManager, char *szModuleName, c
3131
(*fVersion) = MODULE_VERSION;
3232

3333
#ifdef WIN32
34+
35+
#ifndef _DEBUG
36+
#undef assert
37+
#define assert(x) __noop(x)
38+
#endif
39+
3440
WSADATA wsaData;
35-
memset(&wsaData, 0, sizeof(WSADATA)); // Same as ZeroMemory.
36-
if (WSAStartup(MAKEWORD(2,2), &wsaData) != 0)
41+
42+
if ( WSAStartup ( MAKEWORD ( 2, 2 ), &wsaData ) != 0 )
3743
{
44+
assert ( false );
3845
pModuleManager->ErrorPrintf("[Sockets] Can't start Winsock, aborting...");
3946
return false;
4047
}
@@ -54,27 +61,28 @@ MTAEXPORT void RegisterFunctions ( lua_State * luaVM )
5461
pModuleManager->RegisterFunction ( luaVM, "sockClose", CFunctions::sockClose );
5562

5663
// Add events
57-
CFunctions::AddEvent(luaVM, "onSockOpened");
58-
CFunctions::AddEvent(luaVM, "onSockData");
59-
CFunctions::AddEvent(luaVM, "onSockClosed");
64+
CFunctions::AddEvent ( luaVM, "onSockOpened" );
65+
CFunctions::AddEvent ( luaVM, "onSockData" );
66+
CFunctions::AddEvent ( luaVM, "onSockClosed" );
6067
}
6168
}
6269

6370

6471
MTAEXPORT bool DoPulse ( void )
6572
{
66-
CSocketManager::DoPulse();
73+
CSocketManager::DoPulse ( );
6774
return true;
6875
}
6976

77+
7078
MTAEXPORT bool ShutdownModule ( void )
7179
{
7280
// Stop all sockets before shutting down the module
73-
CSocketManager::HandleStop();
81+
CSocketManager::HandleStop ( );
7482

7583
#ifdef WIN32
7684
// Cleanup Winsock stuff
77-
WSACleanup();
85+
WSACleanup ( );
7886
#endif
7987

8088
return true;

sockets/ml_sockets.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
#pragma warning (disable : 4244) // DISABLE: conversion from 'SOCKET' to 'int', possible loss of data
2727
#endif
2828

29+
#include <assert.h>
30+
2931
/** MODULE SPECIFIC INFORMATION **/
3032
#define MODULE_NAME "Sockets Module"
3133
#define MODULE_AUTHOR "Gamesnert, MCvarial & x86"

sockets/ml_sockets.vcproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
TreatWChar_tAsBuiltInType="true"
5454
UsePrecompiledHeader="0"
5555
WarningLevel="3"
56-
Detect64BitPortabilityProblems="true"
56+
Detect64BitPortabilityProblems="false"
5757
DebugInformationFormat="4"
5858
/>
5959
<Tool
@@ -138,7 +138,7 @@
138138
TreatWChar_tAsBuiltInType="true"
139139
UsePrecompiledHeader="0"
140140
WarningLevel="3"
141-
Detect64BitPortabilityProblems="true"
141+
Detect64BitPortabilityProblems="false"
142142
DebugInformationFormat="3"
143143
/>
144144
<Tool

0 commit comments

Comments
 (0)