mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-18 11:19:10 +00:00
Get rid of NEW(), TRACKED_NEW, and ZERO().
This commit is contained in:
@ -177,7 +177,7 @@ static void HandleFailedOp (
|
||||
|
||||
// create sub-operations to read the rest of the buffer
|
||||
for (; position < op->rw.bytes; ++subOperations) {
|
||||
NtOpFileReadWrite * childOp = NEW(NtOpFileReadWrite);
|
||||
NtOpFileReadWrite * childOp = new NtOpFileReadWrite;
|
||||
childOp->overlapped.hEvent = op->overlapped.hEvent ? CreateEvent(nil, true, false, nil) : nil;
|
||||
childOp->overlapped.Offset = (uint32_t) ((op->rw.offset + position) & 0xffffffff);
|
||||
childOp->overlapped.OffsetHigh = (uint32_t) ((op->rw.offset + position) >> 32);
|
||||
@ -654,7 +654,7 @@ AsyncId NtFileRead (
|
||||
// enable the sequential thread to perform a wait operation, we set the event field
|
||||
// into the Overlapped structure, because the event will be signaled prior to the
|
||||
// potentially deadlocking callback notification.
|
||||
NtOpFileReadWrite * op = NEW(NtOpFileReadWrite);
|
||||
NtOpFileReadWrite * op = new NtOpFileReadWrite;
|
||||
op->overlapped.Offset = (uint32_t) (offset & 0xffffffff);
|
||||
op->overlapped.OffsetHigh = (uint32_t) (offset >> 32);
|
||||
op->overlapped.hEvent = (flags & kAsyncFileRwSync) ? CreateEvent(nil, true, false, nil) : nil;
|
||||
@ -708,7 +708,7 @@ AsyncId NtFileWrite (
|
||||
// enable the sequential thread to perform a wait operation, we set the event field
|
||||
// into the Overlapped structure, because the event will be signaled prior to the
|
||||
// potentially deadlocking callback notification.
|
||||
NtOpFileReadWrite * op = NEW(NtOpFileReadWrite);
|
||||
NtOpFileReadWrite * op = new NtOpFileReadWrite;
|
||||
op->overlapped.Offset = (uint32_t) (offset & 0xffffffff);
|
||||
op->overlapped.OffsetHigh = (uint32_t) (offset >> 32);
|
||||
op->overlapped.hEvent = (flags & kAsyncFileRwSync) ? CreateEvent(nil, true, false, nil) : nil;
|
||||
@ -756,7 +756,7 @@ AsyncId NtFileFlushBuffers (
|
||||
ASSERT((truncateSize == kAsyncFileDontTruncate) || !(truncateSize & file->sectorSizeMask));
|
||||
|
||||
// create new operation
|
||||
NtOpFileFlush * op = NEW(NtOpFileFlush);
|
||||
NtOpFileFlush * op = new NtOpFileFlush;
|
||||
file->critsect.Enter();
|
||||
|
||||
// write operations cannot complete while a flush is in progress
|
||||
@ -887,7 +887,7 @@ AsyncId NtFileCreateSequence (
|
||||
ASSERT(file->ioType == kNtFile);
|
||||
|
||||
// create new operation
|
||||
NtOpFileSequence * op = NEW(NtOpFileSequence);
|
||||
NtOpFileSequence * op = new NtOpFileSequence;
|
||||
file->critsect.Enter();
|
||||
|
||||
// init Operation
|
||||
@ -968,7 +968,7 @@ bool NtFileWaitId (AsyncFile conn, AsyncId asyncId, unsigned timeoutMs) {
|
||||
|
||||
// create an object to wait on
|
||||
if (!op->signalComplete)
|
||||
op->signalComplete = NEW(CNtWaitHandle);
|
||||
op->signalComplete = new CNtWaitHandle;
|
||||
signalComplete = op->signalComplete;
|
||||
signalComplete->IncRef();
|
||||
break;
|
||||
|
@ -971,7 +971,7 @@ void INtSocketOpCompleteSocketConnect (NtOpConnAttempt * op) {
|
||||
failed.param = op->param;
|
||||
failed.connType = op->sendData[0];
|
||||
failed.remoteAddr = op->remoteAddr;
|
||||
ZERO(failed.localAddr);
|
||||
memset(&failed.localAddr, 0, sizeof(failed.localAddr));
|
||||
op->notifyProc(nil, kNotifySocketConnectFailed, &failed, nil);
|
||||
}
|
||||
|
||||
@ -1399,7 +1399,7 @@ bool NtSocketWrite (
|
||||
}
|
||||
|
||||
// init Operation
|
||||
NtOpSocketWrite * op = NEW(NtOpSocketWrite);
|
||||
NtOpSocketWrite * op = new NtOpSocketWrite;
|
||||
op->overlapped.Offset = 0;
|
||||
op->overlapped.OffsetHigh = 0;
|
||||
op->overlapped.hEvent = nil;
|
||||
|
@ -322,7 +322,7 @@ AsyncId W9xFileCreateSequence (
|
||||
CFile * object = (CFile *)file;
|
||||
|
||||
// Queue an operation
|
||||
FileOp * op = NEW(FileOp);
|
||||
FileOp * op = new FileOp;
|
||||
op->code = kNotifyFileSequence;
|
||||
op->notify = notify;
|
||||
op->data.flush.param = param;
|
||||
@ -342,7 +342,7 @@ AsyncId W9xFileFlushBuffers (
|
||||
CFile * object = (CFile *)file;
|
||||
|
||||
// Queue an operation
|
||||
FileOp * op = NEW(FileOp);
|
||||
FileOp * op = new FileOp;
|
||||
op->code = kNotifyFileFlush;
|
||||
op->notify = notify;
|
||||
op->data.flush.param = param;
|
||||
@ -401,7 +401,7 @@ AsyncFile W9xFileOpen (
|
||||
GetFileTime(fileHandle, nil, nil, (FILETIME *) &lastWriteTime);
|
||||
|
||||
// Create a file object
|
||||
CFile * object = NEW(CFile)(
|
||||
CFile * object = new CFile(
|
||||
fileHandle,
|
||||
notifyProc,
|
||||
userState
|
||||
@ -436,7 +436,7 @@ AsyncId W9xFileRead (
|
||||
|
||||
// Queue asynchronous operations
|
||||
else {
|
||||
FileOp * op = NEW(FileOp);
|
||||
FileOp * op = new FileOp;
|
||||
op->code = kNotifyFileRead;
|
||||
op->notify = (flags & kAsyncFileRwNotify) != 0;
|
||||
op->data.read.param = param;
|
||||
@ -492,7 +492,7 @@ AsyncId W9xFileWrite (
|
||||
|
||||
// Queue asynchronous operations
|
||||
else {
|
||||
FileOp * op = NEW(FileOp);
|
||||
FileOp * op = new FileOp;
|
||||
op->code = kNotifyFileWrite;
|
||||
op->notify = (flags & kAsyncFileRwNotify) != 0;
|
||||
op->data.write.param = param;
|
||||
|
@ -430,8 +430,8 @@ void CSocket::OnConnect () {
|
||||
|
||||
// Get addresses for the connection notification
|
||||
AsyncNotifySocketConnect notify;
|
||||
ZERO(notify.localAddr);
|
||||
ZERO(notify.remoteAddr);
|
||||
memset(¬ify.localAddr, 0, sizeof(notify.localAddr));
|
||||
memset(¬ify.remoteAddr, 0, sizeof(notify.remoteAddr));
|
||||
int nameLen = sizeof(notify.localAddr);
|
||||
if (getsockname(m_sock, (sockaddr *)¬ify.localAddr, &nameLen))
|
||||
if (GetLastError() == WSAENOTCONN)
|
||||
@ -656,7 +656,7 @@ void CSocket::QueueConnect (
|
||||
) {
|
||||
ASSERT(!IsConnected() && !IsDisconnected());
|
||||
|
||||
Command * command = NEW(Command);
|
||||
Command * command = new Command;
|
||||
command->code = command->CONNECT;
|
||||
command->param = param;
|
||||
command->connect.connType = connType;
|
||||
@ -671,7 +671,7 @@ void CSocket::QueueWrite (
|
||||
) {
|
||||
ASSERT(!IsDisconnected());
|
||||
|
||||
Command * command = NEW(Command);
|
||||
Command * command = new Command;
|
||||
command->code = command->CONNECT;
|
||||
command->param = param;
|
||||
command->write.data = data;
|
||||
@ -913,7 +913,7 @@ static unsigned THREADCALL W9xSocketThreadProc (AsyncThread *) {
|
||||
// Register the window class
|
||||
HINSTANCE instance = (HINSTANCE)GetModuleHandle(nil);
|
||||
WNDCLASS wndClass;
|
||||
ZERO(wndClass);
|
||||
memset(&wndClass, 0, sizeof(wndClass));
|
||||
wndClass.lpfnWndProc = WndProc;
|
||||
wndClass.hInstance = instance;
|
||||
wndClass.lpszClassName = CLASS_NAME;
|
||||
@ -1027,7 +1027,7 @@ void W9xSocketConnect (
|
||||
UINT message = (s_message++ & 0x3fff) | WM_APP; // range 0x8000 - 0xbfff
|
||||
|
||||
// Create a socket object
|
||||
CSocket * object = NEW(CSocket)(
|
||||
CSocket * object = new CSocket(
|
||||
sequence,
|
||||
message,
|
||||
sock,
|
||||
|
@ -206,7 +206,7 @@ void CThreadDispObject::Close () {
|
||||
//===========================================================================
|
||||
AsyncId CThreadDispObject::Queue (void * op) {
|
||||
AsyncId asyncId = 0;
|
||||
NEW(CThreadDispRec)(this, op, &asyncId);
|
||||
new CThreadDispRec(this, op, &asyncId);
|
||||
SetEvent(s_signalEvent);
|
||||
return asyncId;
|
||||
}
|
||||
|
@ -158,7 +158,7 @@ static void LookupFindAndProcess (HANDLE cancelHandle, unsigned error) {
|
||||
static unsigned THREADCALL LookupThreadProc (AsyncThread * thread) {
|
||||
static const char WINDOW_CLASS[] = "AsyncLookupWnd";
|
||||
WNDCLASS wc;
|
||||
ZERO(wc);
|
||||
memset(&wc, 0, sizeof(wc));
|
||||
wc.lpfnWndProc = DefWindowProc;
|
||||
wc.hInstance = GetModuleHandle(0);
|
||||
wc.lpszClassName = WINDOW_CLASS;
|
||||
@ -291,7 +291,7 @@ void AsyncAddressLookupName (
|
||||
}
|
||||
|
||||
// Initialize lookup
|
||||
Lookup * lookup = NEW(Lookup);
|
||||
Lookup * lookup = new Lookup;
|
||||
lookup->lookupProc = lookupProc;
|
||||
lookup->port = port;
|
||||
lookup->param = param;
|
||||
@ -336,7 +336,7 @@ void AsyncAddressLookupAddr (
|
||||
PerfAddCounter(kAsyncPerfNameLookupAttemptsTotal, 1);
|
||||
|
||||
// Initialize lookup
|
||||
Lookup * lookup = NEW(Lookup);
|
||||
Lookup * lookup = new Lookup;
|
||||
lookup->lookupProc = lookupProc;
|
||||
lookup->port = 1;
|
||||
lookup->param = param;
|
||||
|
@ -234,7 +234,7 @@ void AsyncThreadTaskSetThreadCount (unsigned threads) {
|
||||
//===========================================================================
|
||||
AsyncThreadTaskList * AsyncThreadTaskListCreate () {
|
||||
ASSERT(s_taskPort);
|
||||
AsyncThreadTaskList * taskList = NEW(AsyncThreadTaskList);
|
||||
AsyncThreadTaskList * taskList = new AsyncThreadTaskList;
|
||||
taskList->IncRef("TaskList");
|
||||
return taskList;
|
||||
}
|
||||
@ -266,7 +266,7 @@ void AsyncThreadTaskAdd (
|
||||
ASSERT(priority == kThreadTaskPriorityNormal);
|
||||
|
||||
// Allocate a new task record
|
||||
ThreadTask * task = NEW(ThreadTask);
|
||||
ThreadTask * task = new ThreadTask;
|
||||
task->taskList = taskList;
|
||||
task->callback = callback;
|
||||
task->param = param;
|
||||
|
@ -212,7 +212,7 @@ void AsyncCoreDestroy (unsigned waitMs) {
|
||||
TimerDestroy(waitMs);
|
||||
ThreadDestroy(waitMs);
|
||||
|
||||
ZERO(g_api);
|
||||
memset(&g_api, 0, sizeof(g_api));
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
|
@ -504,7 +504,7 @@ void AsyncSocketRegisterNotifyProc (
|
||||
ASSERT(notifyProc);
|
||||
|
||||
// Perform memory allocation outside lock
|
||||
ISocketConnType * ct = NEW(ISocketConnType);
|
||||
ISocketConnType * ct = new ISocketConnType;
|
||||
ct->notifyProc = notifyProc;
|
||||
ct->connType = connType;
|
||||
ct->buildId = buildId;
|
||||
|
@ -109,7 +109,7 @@ void * AsyncThreadCreate (
|
||||
void * argument,
|
||||
const wchar_t name[]
|
||||
) {
|
||||
AsyncThread * thread = NEW(AsyncThread);
|
||||
AsyncThread * thread = new AsyncThread;
|
||||
thread->proc = threadProc;
|
||||
thread->handle = nil;
|
||||
thread->argument = argument;
|
||||
|
@ -253,7 +253,7 @@ void AsyncTimerCreate (
|
||||
ASSERT(timerProc);
|
||||
|
||||
// Allocate timer outside critical section
|
||||
AsyncTimer * t = NEW(AsyncTimer);
|
||||
AsyncTimer * t = new AsyncTimer;
|
||||
t->timerProc = timerProc;
|
||||
t->destroyProc = nil;
|
||||
t->param = param;
|
||||
|
Reference in New Issue
Block a user