Make TCPClientSocket field private
Also, it is a pointer, therefore prevent bugs by disallowing copying and assignment.
This commit is contained in:
parent
0e32c002ae
commit
75478a9a39
2 changed files with 8 additions and 7 deletions
|
@ -93,9 +93,6 @@ TCPClientSocket::TCPClientSocket(int platformsocket)
|
|||
|
||||
TCPClientSocket::TCPClientSocket(TCPsocket source)
|
||||
{
|
||||
#ifdef NATIVESOCKETS
|
||||
nativetcpstruct=0;
|
||||
#endif
|
||||
if (!SDLNetInited) {
|
||||
if (SDLNet_Init() == -1) {
|
||||
LOG_MSG("SDLNet_Init failed: %s\n", SDLNet_GetError());
|
||||
|
@ -116,9 +113,6 @@ TCPClientSocket::TCPClientSocket(TCPsocket source)
|
|||
|
||||
TCPClientSocket::TCPClientSocket(const char* destination, Bit16u port)
|
||||
{
|
||||
#ifdef NATIVESOCKETS
|
||||
nativetcpstruct=0;
|
||||
#endif
|
||||
if (!SDLNetInited) {
|
||||
if (SDLNet_Init() == -1) {
|
||||
LOG_MSG("SDLNet_Init failed: %s\n", SDLNet_GetError());
|
||||
|
|
|
@ -62,9 +62,11 @@ public:
|
|||
TCPClientSocket(TCPsocket source);
|
||||
TCPClientSocket(const char* destination, Bit16u port);
|
||||
#ifdef NATIVESOCKETS
|
||||
Bit8u* nativetcpstruct;
|
||||
TCPClientSocket(int platformsocket);
|
||||
#endif
|
||||
TCPClientSocket(const TCPClientSocket&) = delete; // prevent copying
|
||||
TCPClientSocket& operator=(const TCPClientSocket&) = delete; // prevent assignment
|
||||
|
||||
~TCPClientSocket();
|
||||
|
||||
// return:
|
||||
|
@ -88,6 +90,11 @@ public:
|
|||
bool SendByteBuffered(Bit8u data);
|
||||
|
||||
private:
|
||||
|
||||
#ifdef NATIVESOCKETS
|
||||
Bit8u *nativetcpstruct = nullptr;
|
||||
#endif
|
||||
|
||||
TCPsocket mysock = 0;
|
||||
SDLNet_SocketSet listensocketset = nullptr;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue