Browse Source

Remove stupid

Adam Johnson 13 years ago
parent
commit
906b16d28e
  1. 43
      Sources/Plasma/CoreLib/hsTypes.h
  2. 16
      Sources/Plasma/NucleusLib/pnAsyncCoreExe/Private/Nt/pnAceNtSocket.cpp
  3. 2
      Sources/Plasma/NucleusLib/pnUUID/pnUUID_Win32.cpp
  4. 4
      Sources/Plasma/NucleusLib/pnUtils/Private/pnUtUuid.cpp

43
Sources/Plasma/CoreLib/hsTypes.h

@ -379,9 +379,8 @@ void SWAP (T & a, T & b) {
/****************************************************************************
*
* arrsize/marrsize
* arrsize
* arrsize returns the number of elements in an array variable
* marrsize returns the number of elements in an array field in a structure
*
* Example:
*
@ -390,46 +389,6 @@ void SWAP (T & a, T & b) {
***/
#define arrsize(a) (sizeof(a) / sizeof((a)[0]))
#define marrsize(c,a) (arrsize(((c *)0)->a))
/****************************************************************************
*
* moffsetof returns the offset in bytes of a field inside a structure based on a variable
*
***/
#define moffsetof(v,f) (((uint8_t *) &((v)->f)) - ((uint8_t *) v))
/****************************************************************************
*
* msizeof
* Returns the size of a field in a structure
*
* Example:
*
* unsigned bufferSize = msizeof(CommandStruct, buffer);
*
***/
#define msizeof(c,a) (sizeof(((c *)0)->a))
/****************************************************************************
*
* ONCE
* Shortcut to create a 'for' loop that executes only once
*
* for (ONCE) {
* ...
* }
*
***/
#ifndef ONCE
#define ONCE bool UNIQUE_SYMBOL(ONCE) = true; UNIQUE_SYMBOL(ONCE); UNIQUE_SYMBOL(ONCE) = false
#endif
/****************************************************************************

16
Sources/Plasma/NucleusLib/pnAsyncCoreExe/Private/Nt/pnAceNtSocket.cpp

@ -517,7 +517,7 @@ static SOCKET ListenSocket (NetAddress * listenAddr) {
return INVALID_SOCKET;
}
for (;;) { // actually for (ONCE)
do {
/* this code was an attempt to enable the server to close and then re-open the same port
for listening. It doesn't appear to work, and moreover, it causes the bind to signal
success even though the port cannot be opened (for example, because another application
@ -583,7 +583,7 @@ static SOCKET ListenSocket (NetAddress * listenAddr) {
// success!
NetAddressSetPort(port, listenAddr);
return s;
}
} while (false);
// failure!
closesocket(s);
@ -620,7 +620,7 @@ static SOCKET ConnectSocket (unsigned localPort, const NetAddress & addr) {
return INVALID_SOCKET;
}
for (;;) { // actually for (ONCE)
do {
// make socket non-blocking
u_long nonBlocking = true;
if (ioctlsocket(s, FIONBIO, &nonBlocking))
@ -648,7 +648,7 @@ static SOCKET ConnectSocket (unsigned localPort, const NetAddress & addr) {
// success!
return s;
}
} while (false);
// failure!
closesocket(s);
@ -992,7 +992,7 @@ void INtSocketOpCompleteSocketRead (
) {
ASSERT(sock->ioType == kNtSocket);
for (ONCE) {
do {
// a zero-byte read means the socket is going
// to shutdown, so don't start another read
if (!bytes)
@ -1008,10 +1008,6 @@ void INtSocketOpCompleteSocketRead (
sock->opRead.read.bytes = sock->bytesLeft;
sock->opRead.read.bytesProcessed = 0;
if (sock->connType == kConnTypeCliToAuth) {
int x = 0;
}
if (!SocketDispatchRead(sock))
break;
@ -1063,7 +1059,7 @@ void INtSocketOpCompleteSocketRead (
}
SocketStartAsyncRead(sock);
}
} while(false);
INtConnCompleteOperation(sock);
}

2
Sources/Plasma/NucleusLib/pnUUID/pnUUID_Win32.cpp

@ -47,8 +47,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include <rpc.h>
COMPILER_ASSERT(msizeof(Uuid, data) == msizeof(plUUID, fData));
plUUID::plUUID( const Uuid & uuid )
{
memcpy(fData, uuid.data, sizeof(fData));

4
Sources/Plasma/NucleusLib/pnUtils/Private/pnUtUuid.cpp

@ -99,7 +99,7 @@ const wchar_t * GuidToHex (const Uuid & uuid, wchar_t * dst, unsigned chars) {
//============================================================================
bool GuidFromHex (const uint8_t buf[], unsigned length, Uuid * uuid) {
ASSERT(length == msizeof(Uuid, data));
memcpy(uuid->data, buf, msizeof(Uuid, data));
ASSERT(length == sizeof(uuid->data));
memcpy(uuid->data, buf, sizeof(uuid->data));
return true;
}

Loading…
Cancel
Save