1
0
mirror of https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git synced 2025-07-18 03:09:13 +00:00

Deprecate and remove NEWZERO macro

This commit is contained in:
2013-01-04 21:32:48 -08:00
parent b574a583f4
commit bc0d04da48
55 changed files with 455 additions and 385 deletions

View File

@ -103,12 +103,16 @@ enum EAsyncNotifySocket {
struct AsyncNotifySocket {
void * param;
AsyncId asyncId;
AsyncNotifySocket() : param(nil), asyncId(nil) { }
};
struct AsyncNotifySocketConnect : AsyncNotifySocket {
plNetAddress localAddr;
plNetAddress remoteAddr;
unsigned connType;
AsyncNotifySocketConnect() : connType(0) { }
};
struct AsyncNotifySocketListen : AsyncNotifySocketConnect {
@ -120,12 +124,18 @@ struct AsyncNotifySocketListen : AsyncNotifySocketConnect {
uint8_t * buffer;
unsigned bytes;
unsigned bytesProcessed;
AsyncNotifySocketListen()
: buildId(0), buildType(0), branchId(0), buffer(nil), bytes(0),
bytesProcessed(0) { }
};
struct AsyncNotifySocketRead : AsyncNotifySocket {
uint8_t * buffer;
unsigned bytes;
unsigned bytesProcessed;
AsyncNotifySocketRead() : buffer(nil), bytes(0), bytesProcessed(0) { }
};
typedef AsyncNotifySocketRead AsyncNotifySocketWrite;

View File

@ -83,7 +83,7 @@ struct AsyncThread {
void * handle;
void * argument;
unsigned workTimeMs;
wchar_t name[16];
wchar_t name[16];
};
/*****************************************************************************
@ -95,7 +95,7 @@ struct AsyncThread {
void * AsyncThreadCreate (
FAsyncThreadProc proc,
void * argument,
const wchar_t name[]
const wchar_t name[]
);
// This function should ONLY be called during shutdown while waiting for things to expire

View File

@ -108,12 +108,19 @@ struct Operation {
unsigned pending;
CNtWaitHandle * signalComplete;
LINK(Operation) link;
Operation()
: opType((EOpType)0), asyncId(nil), notify(false), pending(0),
signalComplete(nil)
{
memset(&overlapped, 0, sizeof(overlapped));
}
#ifdef HS_DEBUGGING
~Operation () {
ASSERT(!signalComplete);
}
#endif
#endif
};
struct NtObject {
@ -126,6 +133,11 @@ struct NtObject {
long nextStartSequence;
long ioCount;
bool closed;
NtObject()
: ioType((EIoType)0), handle(nil), userState(nil),
nextCompleteSequence(0), nextStartSequence(0),
ioCount(0), closed(false) { }
};

View File

@ -105,6 +105,8 @@ struct NtOpSocketWrite : Operation {
unsigned queueTimeMs;
unsigned bytesAlloc;
AsyncNotifySocketWrite write;
NtOpSocketWrite() : queueTimeMs(0), bytesAlloc(0) { }
};
struct NtOpSocketRead : Operation {
@ -121,7 +123,7 @@ struct NtSock : NtObject {
NtOpSocketRead opRead;
unsigned backlogAlloc;
unsigned initTimeMs;
uint8_t buffer[kAsyncSocketBufferSize];
uint8_t buffer[kAsyncSocketBufferSize];
NtSock ();
~NtSock ();
@ -144,7 +146,12 @@ static LISTDECL(NtSock, link) s_socketList;
//===========================================================================
inline NtSock::NtSock () {
inline NtSock::NtSock ()
: closeTimeMs(0), connType(0), notifyProc(nil), bytesLeft(0)
, backlogAlloc(0), initTimeMs(0)
{
memset(buffer, 0, sizeof(buffer));
PerfAddCounter(kAsyncPerfSocketsCurr, 1);
PerfAddCounter(kAsyncPerfSocketsTotal, 1);
}
@ -406,7 +413,7 @@ static NtSock * SocketInitCommon (SOCKET hSocket) {
LogMsg(kLogError, "setsockopt(recv) failed (set recv buffer size)");
// allocate a new socket
NtSock * sock = NEWZERO(NtSock);
NtSock * sock = new NtSock;
sock->ioType = kNtSocket;
sock->handle = (HANDLE) hSocket;
sock->initTimeMs = TimeGetMs();

View File

@ -130,13 +130,13 @@ struct NetCli {
const NetMsgField * recvField;
unsigned recvFieldBytes;
bool recvDispatch;
uint8_t * sendCurr; // points into sendBuffer
uint8_t * sendCurr; // points into sendBuffer
CInputAccumulator input;
// Message encryption
ENetCliMode mode;
FNetCliEncrypt encryptFcn;
uint8_t seed[kNetMaxSymmetricSeedBytes];
uint8_t seed[kNetMaxSymmetricSeedBytes];
CryptKey * cryptIn; // nil if encrytpion is disabled
CryptKey * cryptOut; // nil if encrytpion is disabled
void * encryptParam;
@ -144,6 +144,16 @@ struct NetCli {
// Message buffers
uint8_t sendBuffer[kAsyncSocketBufferSize];
ARRAY(uint8_t) recvBuffer;
NetCli()
: sock(nil), protocol((ENetProtocol)0), channel(nil), server(false)
, queue(nil), recvMsg(nil), recvField(nil), recvFieldBytes(0)
, recvDispatch(false), sendCurr(nil), mode((ENetCliMode)0)
, encryptFcn(nil), cryptIn(nil), cryptOut(nil), encryptParam(nil)
{
memset(seed, 0, sizeof(seed));
memset(sendBuffer, 0, sizeof(sendBuffer));
}
};
struct NetCliQueue {
@ -913,7 +923,7 @@ static NetCli * ConnCreate (
if (!channel)
return nil;
NetCli * const cli = NEWZERO(NetCli);
NetCli * const cli = new NetCli;
cli->sock = sock;
cli->protocol = (ENetProtocol) protocol;
cli->channel = channel;

View File

@ -363,9 +363,18 @@ static void DeallocNodeFields (NetVaultNode * node) {
}
//============================================================================
NetVaultNode::NetVaultNode () {
ASSERTMSG(!fieldFlags, "NetVaultNode instances must be allocated with NEWZERO");
}
NetVaultNode::NetVaultNode ()
: fieldFlags(0), dirtyFlags(0)
, nodeId(0), createTime(0), modifyTime(0)
, createAgeName(nil), creatorId(0)
, nodeType(0)
, int32_1(0), int32_2(0), int32_3(0), int32_4(0)
, uint32_1(0), uint32_2(0), uint32_3(0), uint32_4(0)
, string64_1(nil), string64_2(nil), string64_3(nil), string64_4(nil)
, string64_5(nil), string64_6(nil)
, istring64_1(nil), istring64_2(nil)
, text_1(nil), text_2(nil)
, blob_1(nil), blob_1Length(0), blob_2(nil), blob_2Length(0) { }
//============================================================================
NetVaultNode::~NetVaultNode () {

View File

@ -163,6 +163,8 @@ private:
LINK(T) m_linkToSlot;
public:
THashLink() : m_hash(0) { }
inline bool IsLinked () const;
inline T * Next ();
inline const T * Next () const;

View File

@ -105,7 +105,7 @@ class CBaseLink {
protected:
CBaseLink * volatile m_prevLink;
uint8_t * volatile m_next;
uint8_t * volatile m_next;
inline int CalcLinkOffset () const;
inline void InitializeLinks ();