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

Convert custom HeadSpin integer types to standard types from stdint.h

This commit is contained in:
2012-01-19 21:19:26 -05:00
parent a0d54e2644
commit 5027b5a4ac
1301 changed files with 14497 additions and 14532 deletions

View File

@ -126,7 +126,7 @@ void CNtWaitHandle::SignalObject () const {
static void INtOpDispatch (
NtObject * ntObj,
Operation * op,
dword bytes
uint32_t bytes
) {
for (;;) {
switch (op->opType) {
@ -143,12 +143,12 @@ static void INtOpDispatch (
return;
case kOpSocketRead:
ASSERT(bytes != (dword) -1);
ASSERT(bytes != (uint32_t) -1);
INtSocketOpCompleteSocketRead((NtSock *) ntObj, bytes);
return;
case kOpSocketWrite:
ASSERT(bytes != (dword) -1);
ASSERT(bytes != (uint32_t) -1);
INtSocketOpCompleteSocketWrite((NtSock *) ntObj, (NtOpSocketWrite *) op);
break;
@ -161,7 +161,7 @@ static void INtOpDispatch (
case kOpFileRead:
case kOpFileWrite:
ASSERT(bytes != (dword) -1);
ASSERT(bytes != (uint32_t) -1);
if (!INtFileOpCompleteReadWrite((NtFile *) ntObj, (NtOpFileReadWrite *) op, bytes))
return;
break;
@ -238,7 +238,7 @@ static void INtOpDispatch (
// can only be dispatched when they are completed normally. To ensure that
// we're not accidentally processing an operation that shouldn't be executed,
// set the bytes field to an invalid value.
bytes = (dword) -1;
bytes = (uint32_t) -1;
}
}

View File

@ -83,7 +83,7 @@ struct NtFile : NtObject {
LINK(NtFile) pendLink; // protected by s_fileCrit
unsigned queueWrites;
unsigned sectorSizeMask;
wchar fullPath[MAX_PATH];
wchar_t fullPath[MAX_PATH];
NtFile ();
~NtFile ();
@ -179,8 +179,8 @@ static void HandleFailedOp (
for (; position < op->rw.bytes; ++subOperations) {
NtOpFileReadWrite * childOp = NEW(NtOpFileReadWrite);
childOp->overlapped.hEvent = op->overlapped.hEvent ? CreateEvent(nil, true, false, nil) : nil;
childOp->overlapped.Offset = (dword) ((op->rw.offset + position) & 0xffffffff);
childOp->overlapped.OffsetHigh = (dword) ((op->rw.offset + position) >> 32);
childOp->overlapped.Offset = (uint32_t) ((op->rw.offset + position) & 0xffffffff);
childOp->overlapped.OffsetHigh = (uint32_t) ((op->rw.offset + position) >> 32);
childOp->opType = op->opType;
childOp->asyncId = 0;
childOp->notify = false;
@ -312,9 +312,9 @@ static void HandleFailedOp (
}
//===========================================================================
static void InternalFileSetSize (NtObject * file, qword size) {
static void InternalFileSetSize (NtObject * file, uint64_t size) {
LONG sizeHigh = (long) (size >> 32);
DWORD seek = SetFilePointer(file->handle, (dword) size, &sizeHigh, FILE_BEGIN);
DWORD seek = SetFilePointer(file->handle, (uint32_t) size, &sizeHigh, FILE_BEGIN);
if ((seek != (DWORD) -1) || (GetLastError() == NO_ERROR))
SetEndOfFile(file->handle);
}
@ -547,15 +547,15 @@ void INtFileOpCompleteSequence (
//===========================================================================
AsyncFile NtFileOpen (
const wchar fullPath[],
const wchar_t fullPath[],
FAsyncNotifyFileProc notifyProc,
EFileError * error,
unsigned desiredAccess,
unsigned openMode,
unsigned shareModeFlags,
void * userState,
qword * fileSize,
qword * fileLastWriteTime
uint64_t * fileSize,
uint64_t * fileLastWriteTime
) {
unsigned attributeFlags = 0;
attributeFlags |= FILE_FLAG_OVERLAPPED;
@ -590,9 +590,9 @@ AsyncFile NtFileOpen (
CloseHandle(handle);
return nil;
}
const qword size = ((qword) sizeHi << (qword) 32) | (qword) sizeLo;
const uint64_t size = ((uint64_t) sizeHi << (uint64_t) 32) | (uint64_t) sizeLo;
qword lastWriteTime;
uint64_t lastWriteTime;
ASSERT(sizeof(lastWriteTime) >= sizeof(FILETIME));
GetFileTime(handle, nil, nil, (FILETIME *) &lastWriteTime);
@ -632,7 +632,7 @@ AsyncFile NtFileOpen (
//===========================================================================
AsyncId NtFileRead (
AsyncFile conn,
qword offset,
uint64_t offset,
void * buffer,
unsigned bytes,
unsigned flags,
@ -644,7 +644,7 @@ AsyncId NtFileRead (
ASSERT((flags & (kAsyncFileRwNotify|kAsyncFileRwSync)) != (kAsyncFileRwNotify|kAsyncFileRwSync));
ASSERT(! (offset & file->sectorSizeMask));
ASSERT(! (bytes & file->sectorSizeMask));
ASSERT(! ((unsigned_ptr) buffer & file->sectorSizeMask));
ASSERT(! ((uintptr_t) buffer & file->sectorSizeMask));
// Normally, I/O events do not complete until both the WIN32 operation has completed
// and the callback notification has occurred. A deadlock can occur if a thread attempts
@ -655,8 +655,8 @@ AsyncId NtFileRead (
// into the Overlapped structure, because the event will be signaled prior to the
// potentially deadlocking callback notification.
NtOpFileReadWrite * op = NEW(NtOpFileReadWrite);
op->overlapped.Offset = (dword) (offset & 0xffffffff);
op->overlapped.OffsetHigh = (dword) (offset >> 32);
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;
op->opType = kOpFileRead;
op->notify = (flags & kAsyncFileRwNotify) != 0;
@ -666,7 +666,7 @@ AsyncId NtFileRead (
op->win32Bytes = bytes;
op->rw.param = param;
op->rw.offset = offset;
op->rw.buffer = (byte *) buffer;
op->rw.buffer = (uint8_t *) buffer;
op->rw.bytes = bytes;
InterlockedIncrement(&file->ioCount);
@ -686,7 +686,7 @@ AsyncId NtFileRead (
// buffer must stay valid until I/O is completed
AsyncId NtFileWrite (
AsyncFile conn,
qword offset,
uint64_t offset,
const void * buffer,
unsigned bytes,
unsigned flags,
@ -698,7 +698,7 @@ AsyncId NtFileWrite (
ASSERT((flags & (kAsyncFileRwNotify|kAsyncFileRwSync)) != (kAsyncFileRwNotify|kAsyncFileRwSync));
ASSERT(! (offset & file->sectorSizeMask));
ASSERT(! (bytes & file->sectorSizeMask));
ASSERT(! ((unsigned_ptr) buffer & file->sectorSizeMask));
ASSERT(! ((uintptr_t) buffer & file->sectorSizeMask));
// Normally, I/O events do not complete until both the WIN32 operation has completed
// and the callback notification has occurred. A deadlock can occur if a thread attempts
@ -709,8 +709,8 @@ AsyncId NtFileWrite (
// into the Overlapped structure, because the event will be signaled prior to the
// potentially deadlocking callback notification.
NtOpFileReadWrite * op = NEW(NtOpFileReadWrite);
op->overlapped.Offset = (dword) (offset & 0xffffffff);
op->overlapped.OffsetHigh = (dword) (offset >> 32);
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;
op->opType = kOpFileWrite;
op->notify = (flags & kAsyncFileRwNotify) != 0;
@ -720,7 +720,7 @@ AsyncId NtFileWrite (
op->win32Bytes = bytes;
op->rw.param = param;
op->rw.offset = offset;
op->rw.buffer = (byte *) buffer;
op->rw.buffer = (uint8_t *) buffer;
op->rw.bytes = bytes;
InterlockedIncrement(&file->ioCount);
@ -745,7 +745,7 @@ AsyncId NtFileWrite (
//===========================================================================
AsyncId NtFileFlushBuffers (
AsyncFile conn,
qword truncateSize,
uint64_t truncateSize,
bool notify,
void * param
) {
@ -799,7 +799,7 @@ AsyncId NtFileFlushBuffers (
//===========================================================================
void NtFileClose (
AsyncFile conn,
qword truncateSize
uint64_t truncateSize
) {
NtFile * file = (NtFile *) conn;
ASSERT(file);
@ -853,7 +853,7 @@ void NtFileClose (
//===========================================================================
void NtFileSetLastWriteTime (
AsyncFile conn,
qword lastWriteTime
uint64_t lastWriteTime
) {
NtFile * file = (NtFile *) conn;
ASSERT(file);
@ -866,12 +866,12 @@ void NtFileSetLastWriteTime (
}
//===========================================================================
qword NtFileGetLastWriteTime (
const wchar fileName[]
uint64_t NtFileGetLastWriteTime (
const wchar_t fileName[]
) {
WIN32_FILE_ATTRIBUTE_DATA info;
bool f = GetFileAttributesExW(fileName, GetFileExInfoStandard, &info);
return f ? *((qword *) &info.ftLastWriteTime) : 0;
return f ? *((uint64_t *) &info.ftLastWriteTime) : 0;
}
//===========================================================================
@ -988,7 +988,7 @@ bool NtFileWaitId (AsyncFile conn, AsyncId asyncId, unsigned timeoutMs) {
//============================================================================
bool NtFileSeek (
AsyncFile conn,
qword distance,
uint64_t distance,
EFileSeekFrom from
) {
COMPILER_ASSERT(kFileSeekFromBegin == FILE_BEGIN);
@ -998,8 +998,8 @@ bool NtFileSeek (
NtFile * file = (NtFile *) conn;
LONG low = (LONG)(distance % 0x100000000ul);
LONG high = (LONG)(distance / 0x100000000ul);
dword result = SetFilePointer(file->handle, low, &high, from);
if ((result == (dword)-1) && (GetLastError() != NO_ERROR)) {
uint32_t result = SetFilePointer(file->handle, low, &high, from);
if ((result == (uint32_t)-1) && (GetLastError() != NO_ERROR)) {
LogMsg(kLogFatal, "failed: SetFilePointer");
return false;
}

View File

@ -229,36 +229,36 @@ void NtSignalShutdown ();
void NtWaitForShutdown ();
void NtSleep (unsigned sleepMs);
AsyncFile NtFileOpen (
const wchar fullPath[],
const wchar_t fullPath[],
FAsyncNotifyFileProc notifyProc,
EFileError * error,
unsigned desiredAccess,
unsigned openMode,
unsigned shareModeFlags,
void * userState,
qword * fileSize,
qword * fileLastWriteTime
uint64_t * fileSize,
uint64_t * fileLastWriteTime
);
void NtFileClose (
AsyncFile file,
qword truncateSize
uint64_t truncateSize
);
void NtFileSetLastWriteTime (
AsyncFile file,
qword lastWriteTime
uint64_t lastWriteTime
);
qword NtFileGetLastWriteTime (
const wchar fileName[]
uint64_t NtFileGetLastWriteTime (
const wchar_t fileName[]
);
AsyncId NtFileFlushBuffers (
AsyncFile file,
qword truncateSize,
uint64_t truncateSize,
bool notify,
void * param
);
AsyncId NtFileRead (
AsyncFile file,
qword offset,
uint64_t offset,
void * buffer,
unsigned bytes,
unsigned flags,
@ -266,7 +266,7 @@ AsyncId NtFileRead (
);
AsyncId NtFileWrite (
AsyncFile file,
qword offset,
uint64_t offset,
const void *buffer,
unsigned bytes,
unsigned flags,
@ -279,7 +279,7 @@ AsyncId NtFileCreateSequence (
);
bool NtFileSeek (
AsyncFile file,
qword distance,
uint64_t distance,
EFileSeekFrom from
);
void NtSocketConnect (

View File

@ -97,7 +97,7 @@ struct NtOpConnAttempt : Operation {
SOCKET hSocket;
unsigned failTimeMs;
unsigned sendBytes;
byte sendData[1]; // actually [sendBytes]
uint8_t sendData[1]; // actually [sendBytes]
// no additional fields
};
@ -121,7 +121,7 @@ struct NtSock : NtObject {
NtOpSocketRead opRead;
unsigned backlogAlloc;
unsigned initTimeMs;
byte buffer[kAsyncSocketBufferSize];
uint8_t buffer[kAsyncSocketBufferSize];
NtSock ();
~NtSock ();
@ -291,7 +291,7 @@ static bool SocketDispatchRead (NtSock * sock) {
//===========================================================================
static NtOpSocketWrite * SocketQueueAsyncWrite (
NtSock * sock,
const byte * data,
const uint8_t * data,
unsigned bytes
) {
// check for data backlog
@ -367,7 +367,7 @@ static NtOpSocketWrite * SocketQueueAsyncWrite (
op->bytesAlloc = bytesAlloc;
op->write.param = nil;
op->write.asyncId = asyncId;
op->write.buffer = (byte *) (op + 1);
op->write.buffer = (uint8_t *) (op + 1);
op->write.bytes = bytes;
op->write.bytesProcessed = bytes;
MemCopy(op->write.buffer, data, bytes);
@ -546,11 +546,11 @@ static SOCKET ListenSocket (NetAddress * listenAddr) {
// bind socket to port
sockaddr_in addr;
addr.sin_family = AF_INET;
addr.sin_port = htons((word)port);
addr.sin_port = htons((uint16_t)port);
addr.sin_addr.S_un.S_addr = htonl(node);
MemZero(addr.sin_zero, sizeof(addr.sin_zero));
if (bind(s, (sockaddr *) &addr, sizeof(addr))) {
wchar str[32];
wchar_t str[32];
NetAddressToString(*listenAddr, str, arrsize(str), kNetAddressFormatAll);
LogMsg(kLogError, "bind to addr %s failed (err %u)", str, WSAGetLastError());
break;
@ -630,7 +630,7 @@ static SOCKET ConnectSocket (unsigned localPort, const NetAddress & addr) {
if (localPort) {
sockaddr_in addr;
addr.sin_family = AF_INET;
addr.sin_port = htons((word) localPort);
addr.sin_port = htons((uint16_t) localPort);
addr.sin_addr.S_un.S_addr = INADDR_ANY;
MemZero(addr.sin_zero, sizeof(addr.sin_zero));
if (bind(s, (sockaddr *) &addr, sizeof(addr))) {
@ -800,13 +800,13 @@ static void StartListenThread () {
#ifdef HS_DEBUGGING
#include <StdIo.h>
static void __cdecl DumpInvalidData (
const wchar filename[],
const wchar_t filename[],
unsigned bytes,
const byte data[],
const uint8_t data[],
const char fmt[],
...
) {
wchar path[MAX_PATH];
wchar_t path[MAX_PATH];
PathGetProgramDirectory(path, arrsize(path));
PathAddFilename(path, path, L"Log", arrsize(path));
PathAddFilename(path, path, filename, arrsize(path));
@ -1351,7 +1351,7 @@ bool NtSocketSend (
break;
// subtract the data we already sent
data = (const byte *) data + bytesSent;
data = (const uint8_t *) data + bytesSent;
bytes -= bytesSent;
// and queue it below
}
@ -1363,7 +1363,7 @@ bool NtSocketSend (
}
}
NtOpSocketWrite * op = SocketQueueAsyncWrite(sock, (const byte *) data, bytes);
NtOpSocketWrite * op = SocketQueueAsyncWrite(sock, (const uint8_t *) data, bytes);
if (op && !dataQueued)
result = INtSocketOpCompleteQueuedSocketWrite(sock, op);
else
@ -1415,7 +1415,7 @@ bool NtSocketWrite (
op->bytesAlloc = bytes;
op->write.param = param;
op->write.asyncId = op->asyncId;
op->write.buffer = (byte *) buffer;
op->write.buffer = (uint8_t *) buffer;
op->write.bytes = bytes;
op->write.bytesProcessed = bytes;
PerfAddCounter(kAsyncPerfSocketBytesWaitQueued, bytes);

View File

@ -98,22 +98,22 @@ public:
~CFile ();
void Read (
qword offset,
uint64_t offset,
void * buffer,
unsigned bytes
);
void SetLastWriteTime (qword lastWriteTime);
void SetLastWriteTime (uint64_t lastWriteTime);
void Truncate (qword size);
void Truncate (uint64_t size);
void Write (
qword offset,
uint64_t offset,
const void * buffer,
unsigned bytes
);
bool Seek (qword offset, EFileSeekFrom from);
bool Seek (uint64_t offset, EFileSeekFrom from);
};
//===========================================================================
@ -195,7 +195,7 @@ void CFile::Delete (void * op) {
//===========================================================================
void CFile::Read (
qword offset,
uint64_t offset,
void * buffer,
unsigned bytes
) {
@ -215,7 +215,7 @@ void CFile::Read (
// Handle errors
if (bytesRead != bytes)
MemZero((byte *)buffer + bytesRead, bytes - bytesRead);
MemZero((uint8_t *)buffer + bytesRead, bytes - bytesRead);
if ( (!result && (GetLastError() != ERROR_IO_PENDING)) ||
(bytesRead != bytes) )
LogMsg(kLogFatal, "failed: ReadFile");
@ -223,15 +223,15 @@ void CFile::Read (
}
//===========================================================================
bool CFile::Seek (qword offset, EFileSeekFrom from) {
bool CFile::Seek (uint64_t offset, EFileSeekFrom from) {
COMPILER_ASSERT(kFileSeekFromBegin == FILE_BEGIN);
COMPILER_ASSERT(kFileSeekFromCurrent == FILE_CURRENT);
COMPILER_ASSERT(kFileSeekFromEnd == FILE_END);
LONG low = (LONG)(offset % 0x100000000ul);
LONG high = (LONG)(offset / 0x100000000ul);
dword result = SetFilePointer(m_handle, low, &high, from);
if ((result == (dword)-1) && (GetLastError() != NO_ERROR)) {
uint32_t result = SetFilePointer(m_handle, low, &high, from);
if ((result == (uint32_t)-1) && (GetLastError() != NO_ERROR)) {
LogMsg(kLogFatal, "failed: SetFilePointer");
return false;
}
@ -240,13 +240,13 @@ bool CFile::Seek (qword offset, EFileSeekFrom from) {
}
//===========================================================================
void CFile::SetLastWriteTime (qword lastWriteTime) {
void CFile::SetLastWriteTime (uint64_t lastWriteTime) {
COMPILER_ASSERT(sizeof(lastWriteTime) == sizeof(FILETIME));
SetFileTime(m_handle, nil, nil, (const FILETIME *)&lastWriteTime);
}
//===========================================================================
void CFile::Truncate (qword size) {
void CFile::Truncate (uint64_t size) {
ASSERT(size != kAsyncFileDontTruncate);
if (Seek(size, kFileSeekFromBegin) && !SetEndOfFile(m_handle))
@ -255,7 +255,7 @@ void CFile::Truncate (qword size) {
//===========================================================================
void CFile::Write (
qword offset,
uint64_t offset,
const void * buffer,
unsigned bytes
) {
@ -296,7 +296,7 @@ void CFile::Write (
//===========================================================================
void W9xFileClose (
AsyncFile file,
qword truncateSize
uint64_t truncateSize
) {
// Dereference the object
@ -333,7 +333,7 @@ AsyncId W9xFileCreateSequence (
//===========================================================================
AsyncId W9xFileFlushBuffers (
AsyncFile file,
qword truncateSize,
uint64_t truncateSize,
bool notify,
void * param
) {
@ -354,15 +354,15 @@ AsyncId W9xFileFlushBuffers (
//===========================================================================
AsyncFile W9xFileOpen (
const wchar fullPath[],
const wchar_t fullPath[],
FAsyncNotifyFileProc notifyProc,
EFileError * error,
unsigned desiredAccess,
unsigned openMode,
unsigned shareModeFlags,
void * userState,
qword * fileSize,
qword * fileLastWriteTime
uint64_t * fileSize,
uint64_t * fileLastWriteTime
) {
HANDLE fileHandle = CreateFileW(
fullPath,
@ -394,9 +394,9 @@ AsyncFile W9xFileOpen (
CloseHandle(fileHandle);
return nil;
}
const qword size = ((qword) sizeHi << (qword) 32) | (qword) sizeLo;
const uint64_t size = ((uint64_t) sizeHi << (uint64_t) 32) | (uint64_t) sizeLo;
qword lastWriteTime;
uint64_t lastWriteTime;
ASSERT(sizeof(lastWriteTime) >= sizeof(FILETIME));
GetFileTime(fileHandle, nil, nil, (FILETIME *) &lastWriteTime);
@ -418,7 +418,7 @@ AsyncFile W9xFileOpen (
//===========================================================================
AsyncId W9xFileRead (
AsyncFile file,
qword offset,
uint64_t offset,
void * buffer,
unsigned bytes,
unsigned flags,
@ -441,7 +441,7 @@ AsyncId W9xFileRead (
op->notify = (flags & kAsyncFileRwNotify) != 0;
op->data.read.param = param;
op->data.read.offset = offset;
op->data.read.buffer = (byte *)buffer;
op->data.read.buffer = (uint8_t *)buffer;
op->data.read.bytes = bytes;
return object->Queue(op);
}
@ -451,7 +451,7 @@ AsyncId W9xFileRead (
//===========================================================================
void W9xFileSetLastWriteTime (
AsyncFile file,
qword lastWriteTime
uint64_t lastWriteTime
) {
// Dereference the object
@ -463,18 +463,18 @@ void W9xFileSetLastWriteTime (
}
//===========================================================================
qword W9xFileGetLastWriteTime (
const wchar fileName[]
uint64_t W9xFileGetLastWriteTime (
const wchar_t fileName[]
) {
WIN32_FILE_ATTRIBUTE_DATA info;
bool f = GetFileAttributesExW(fileName, GetFileExInfoStandard, &info);
return f ? *((qword *) &info.ftLastWriteTime) : 0;
return f ? *((uint64_t *) &info.ftLastWriteTime) : 0;
}
//===========================================================================
AsyncId W9xFileWrite (
AsyncFile file,
qword offset,
uint64_t offset,
const void * buffer,
unsigned bytes,
unsigned flags,
@ -497,7 +497,7 @@ AsyncId W9xFileWrite (
op->notify = (flags & kAsyncFileRwNotify) != 0;
op->data.write.param = param;
op->data.write.offset = offset;
op->data.write.buffer = (byte *)buffer;
op->data.write.buffer = (uint8_t *)buffer;
op->data.write.bytes = bytes;
return object->Queue(op);
}
@ -507,7 +507,7 @@ AsyncId W9xFileWrite (
//============================================================================
bool W9xFileSeek (
AsyncFile file,
qword distance,
uint64_t distance,
EFileSeekFrom from
) {
CFile * object = (CFile *)file;

View File

@ -88,36 +88,36 @@ bool W9xThreadWaitId (
);
AsyncFile W9xFileOpen (
const wchar fullPath[],
const wchar_t fullPath[],
FAsyncNotifyFileProc notifyProc,
EFileError * error,
unsigned desiredAccess,
unsigned openMode,
unsigned shareModeFlags,
void * userState,
qword * fileSize,
qword * fileLastWriteTime
uint64_t * fileSize,
uint64_t * fileLastWriteTime
);
void W9xFileClose (
AsyncFile file,
qword truncateSize
uint64_t truncateSize
);
void W9xFileSetLastWriteTime (
AsyncFile file,
qword lastWriteTime
uint64_t lastWriteTime
);
qword W9xFileGetLastWriteTime (
const wchar fileName[]
uint64_t W9xFileGetLastWriteTime (
const wchar_t fileName[]
);
AsyncId W9xFileFlushBuffers (
AsyncFile file,
qword truncateSize,
uint64_t truncateSize,
bool notify,
void * param
);
AsyncId W9xFileRead (
AsyncFile file,
qword offset,
uint64_t offset,
void * buffer,
unsigned bytes,
unsigned flags,
@ -125,7 +125,7 @@ AsyncId W9xFileRead (
);
AsyncId W9xFileWrite (
AsyncFile file,
qword offset,
uint64_t offset,
const void *buffer,
unsigned bytes,
unsigned flags,
@ -138,7 +138,7 @@ AsyncId W9xFileCreateSequence (
);
bool W9xFileSeek (
AsyncFile file,
qword distance,
uint64_t distance,
EFileSeekFrom from
);
void W9xSocketConnect (

View File

@ -194,7 +194,7 @@ private:
void * param;
union {
struct {
byte connType;
uint8_t connType;
} connect;
struct {
const void * data; // pointer to application's data
@ -206,7 +206,7 @@ private:
// These variables are protected by the critical section
CCritSect m_critSect;
LISTDECL(Command, link) m_commandList;
ARRAY(byte) m_sendQueue;
ARRAY(uint8_t) m_sendQueue;
// These variables are never modified outside the constructor and
// destructor
@ -218,7 +218,7 @@ private:
// These variables are only ever touched during a callback from the
// window procedure, which is single threaded
unsigned m_dispatched;
byte m_readBuffer[1460 * 2];
uint8_t m_readBuffer[1460 * 2];
unsigned m_readBytes;
void * m_userState;
@ -246,7 +246,7 @@ public:
void ProcessQueue ();
void QueueConnect (
void * param,
byte connType
uint8_t connType
);
void QueueWrite (
void * param,
@ -583,7 +583,7 @@ void CSocket::OnWriteReady () {
&m_sendQueue[result],
m_sendQueue.Bytes() - result
);
COMPILER_ASSERT(sizeof(m_sendQueue[0]) == sizeof(byte));
COMPILER_ASSERT(sizeof(m_sendQueue[0]) == sizeof(uint8_t));
m_sendQueue.SetCount(m_sendQueue.Count() - result);
}
@ -625,7 +625,7 @@ void CSocket::ProcessQueue () {
AsyncNotifySocketWrite notify;
notify.param = command->param;
notify.asyncId = 0;
notify.buffer = (byte *)command->write.data;
notify.buffer = (uint8_t *)command->write.data;
notify.bytes = command->write.bytes;
notify.bytesProcessed = 0;
bool notifyResult = m_notifyProc(
@ -652,7 +652,7 @@ void CSocket::ProcessQueue () {
//===========================================================================
void CSocket::QueueConnect (
void * param,
byte connType
uint8_t connType
) {
ASSERT(!IsConnected() && !IsDisconnected());
@ -710,7 +710,7 @@ bool CSocket::Send ( // returns false if disconnected
// If we were unable to send the entire message, queue the unsent portion
if ((unsigned)result < bytes) {
m_sendQueue.Add(
(const byte *)data + result,
(const uint8_t *)data + result,
bytes - result
);
}
@ -1037,7 +1037,7 @@ void W9xSocketConnect (
// Queue a connect notification for the socket
object->QueueConnect(
param,
sendBytes ? ((const byte *)sendData)[0] : (byte)0
sendBytes ? ((const uint8_t *)sendData)[0] : (uint8_t)0
);
// Queue sending data

View File

@ -245,7 +245,7 @@ static unsigned CALLBACK W9xThreadProc (AsyncThread *) {
// Consume events, check for destruction, and block if we have
// nothing to do.
HANDLE events[] = {s_destroyEvent, s_signalEvent};
dword result = WaitForMultipleObjects(
uint32_t result = WaitForMultipleObjects(
arrsize(events),
events,
FALSE,

View File

@ -69,7 +69,7 @@ struct Lookup {
FAsyncLookupProc lookupProc;
unsigned port;
void * param;
wchar name[kMaxLookupName];
wchar_t name[kMaxLookupName];
char buffer[MAXGETHOSTSTRUCT];
};
@ -113,7 +113,7 @@ static void LookupProcess (Lookup * lookup, unsigned error) {
MemZero(addrs, sizeof(*addrs) * count);
// fill in address data
const word port = htons((word) lookup->port);
const uint16_t port = htons((uint16_t) lookup->port);
for (unsigned i = 0; i < count; ++i) {
sockaddr_in * inetaddr = (sockaddr_in *) &addrs[i];
inetaddr->sin_family = AF_INET;
@ -270,7 +270,7 @@ void DnsDestroy (unsigned exitThreadWaitMs) {
void AsyncAddressLookupName (
AsyncCancelId * cancelId, // out
FAsyncLookupProc lookupProc,
const wchar name[],
const wchar_t name[],
unsigned port,
void * param
) {

View File

@ -65,7 +65,7 @@ struct ThreadTask {
AsyncThreadTaskList * taskList;
FAsyncThreadTask callback;
void * param;
wchar debugStr[256];
wchar_t debugStr[256];
};
static HANDLE s_taskPort;
@ -257,7 +257,7 @@ void AsyncThreadTaskAdd (
AsyncThreadTaskList * taskList,
FAsyncThreadTask callback,
void * param,
const wchar debugStr[],
const wchar_t debugStr[],
EThreadTaskPriority priority /* = kThreadTaskPriorityNormal */
) {
ASSERT(s_taskPort);

View File

@ -105,41 +105,41 @@ typedef void (* FSleep) (unsigned sleepMs);
// Files
typedef AsyncFile (* FAsyncFileOpen) (
const wchar fullPath[],
const wchar_t fullPath[],
FAsyncNotifyFileProc notifyProc,
EFileError * error,
unsigned desiredAccess,
unsigned openMode,
unsigned shareModeFlags,
void * userState,
qword * fileSize,
qword * fileLastWriteTime
uint64_t * fileSize,
uint64_t * fileLastWriteTime
);
typedef void (* FAsyncFileClose) (
AsyncFile file,
qword truncateSize
uint64_t truncateSize
);
typedef void (* FAsyncFileSetLastWriteTime) (
AsyncFile file,
qword lastWriteTime
uint64_t lastWriteTime
);
typedef qword (* FAsyncFileGetLastWriteTime) (
const wchar fileName[]
typedef uint64_t (* FAsyncFileGetLastWriteTime) (
const wchar_t fileName[]
);
typedef AsyncId (* FAsyncFileFlushBuffers) (
AsyncFile file,
qword truncateSize,
uint64_t truncateSize,
bool notify,
void * param
);
typedef AsyncId (* FAsyncFileRead) (
AsyncFile file,
qword offset,
uint64_t offset,
void * buffer,
unsigned bytes,
unsigned flags,
@ -148,7 +148,7 @@ typedef AsyncId (* FAsyncFileRead) (
typedef AsyncId (* FAsyncFileWrite) (
AsyncFile file,
qword offset,
uint64_t offset,
const void * buffer,
unsigned bytes,
unsigned flags,
@ -163,7 +163,7 @@ typedef AsyncId (* FAsyncFileCreateSequence) (
typedef bool (* FAsyncFileSeek) (
AsyncFile file,
qword distance,
uint64_t distance,
EFileSeekFrom from
);

View File

@ -58,10 +58,10 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
// socket notification procedures
// connection data format:
// byte connType;
// dword buildId; [optional]
// dword branchId; [optional]
// dword buildType; [optional]
// uint8_t connType;
// uint32_t buildId; [optional]
// uint32_t branchId; [optional]
// uint32_t buildType; [optional]
// Uuid productId; [optional]
const unsigned kConnHashFlagsIgnore = 0x01;
const unsigned kConnHashFlagsExactMatch = 0x02;
@ -160,7 +160,7 @@ bool ISocketConnHash::operator== (const ISocketConnHash & rhs) const {
//===========================================================================
static unsigned GetConnHash (
ISocketConnHash * hash,
const byte buffer[],
const uint8_t buffer[],
unsigned bytes
) {
if (!bytes)
@ -174,7 +174,7 @@ static unsigned GetConnHash (
hash->productId = 0;
hash->flags = 0;
// one byte consumed
// one uint8_t consumed
return 1;
}
else {
@ -238,9 +238,9 @@ EFileError AsyncGetLastFileError () {
}
//============================================================================
const wchar * FileErrorToString (EFileError error) {
const wchar_t * FileErrorToString (EFileError error) {
static wchar * s_fileErrorStrings[] = {
static wchar_t * s_fileErrorStrings[] = {
L"FileSuccess",
L"FileErrorInvalidParameter",
L"FileErrorFileNotFound",
@ -255,15 +255,15 @@ const wchar * FileErrorToString (EFileError error) {
//============================================================================
AsyncFile AsyncFileOpen (
const wchar fullPath[],
const wchar_t fullPath[],
FAsyncNotifyFileProc notifyProc,
EFileError * error,
unsigned desiredAccess,
unsigned openMode,
unsigned shareModeFlags,
void * userState,
qword * fileSize,
qword * fileLastWriteTime
uint64_t * fileSize,
uint64_t * fileLastWriteTime
) {
ASSERT(g_api.fileOpen);
return g_api.fileOpen(
@ -282,7 +282,7 @@ AsyncFile AsyncFileOpen (
//============================================================================
void AsyncFileClose (
AsyncFile file,
qword truncateSize
uint64_t truncateSize
) {
ASSERT(g_api.fileClose);
g_api.fileClose(file, truncateSize);
@ -291,15 +291,15 @@ void AsyncFileClose (
//============================================================================
void AsyncFileSetLastWriteTime (
AsyncFile file,
qword lastWriteTime
uint64_t lastWriteTime
) {
ASSERT(g_api.fileSetLastWriteTime);
g_api.fileSetLastWriteTime(file, lastWriteTime);
}
//============================================================================
qword AsyncFileGetLastWriteTime (
const wchar fileName[]
uint64_t AsyncFileGetLastWriteTime (
const wchar_t fileName[]
) {
ASSERT(g_api.fileGetLastWriteTime);
return g_api.fileGetLastWriteTime(fileName);
@ -308,7 +308,7 @@ qword AsyncFileGetLastWriteTime (
//============================================================================
AsyncId AsyncFileFlushBuffers (
AsyncFile file,
qword truncateSize,
uint64_t truncateSize,
bool notify,
void * param
) {
@ -319,7 +319,7 @@ AsyncId AsyncFileFlushBuffers (
//============================================================================
AsyncId AsyncFileRead (
AsyncFile file,
qword offset,
uint64_t offset,
void * buffer,
unsigned bytes,
unsigned flags,
@ -339,7 +339,7 @@ AsyncId AsyncFileRead (
//============================================================================
AsyncId AsyncFileWrite (
AsyncFile file,
qword offset,
uint64_t offset,
const void * buffer,
unsigned bytes,
unsigned flags,
@ -369,7 +369,7 @@ AsyncId AsyncFileCreateSequence (
//============================================================================
bool AsyncFileSeek (
AsyncFile file,
qword distance,
uint64_t distance,
EFileSeekFrom seekFrom
) {
ASSERT(g_api.fileSeek);
@ -493,7 +493,7 @@ void AsyncSocketEnableNagling (
//===========================================================================
void AsyncSocketRegisterNotifyProc (
byte connType,
uint8_t connType,
FAsyncNotifySocketProc notifyProc,
unsigned buildId,
unsigned buildType,
@ -522,7 +522,7 @@ void AsyncSocketRegisterNotifyProc (
//===========================================================================
void AsyncSocketUnregisterNotifyProc (
byte connType,
uint8_t connType,
FAsyncNotifySocketProc notifyProc,
unsigned buildId,
unsigned buildType,
@ -558,7 +558,7 @@ void AsyncSocketUnregisterNotifyProc (
//===========================================================================
FAsyncNotifySocketProc AsyncSocketFindNotifyProc (
const byte buffer[],
const uint8_t buffer[],
unsigned bytes,
unsigned * bytesProcessed,
unsigned * connType,

View File

@ -76,11 +76,11 @@ enum ELogType {
};
static bool s_breakOnErrors;
static wchar s_directory[MAX_PATH];
static wchar_t s_directory[MAX_PATH];
static CCritSect s_logCrit[kNumLogTypes];
static char * s_logBuf[kNumLogTypes];
static unsigned s_logPos[kNumLogTypes];
static qword s_logWritePos[kNumLogTypes];
static uint64_t s_logWritePos[kNumLogTypes];
static TimeDesc s_logTime[kNumLogTypes];
static unsigned s_logWriteMs[kNumLogTypes];
static AsyncFile s_logFile[kNumLogTypes];
@ -98,7 +98,7 @@ static unsigned s_logSize[kNumLogTypes] = {
#endif
};
static const wchar * s_logNameFmt[kNumLogTypes] = {
static const wchar_t * s_logNameFmt[kNumLogTypes] = {
#ifdef SERVER
L"Dbg%02u%02u%02u.log",
L"Inf%02u%02u%02u.log",
@ -180,7 +180,7 @@ static void FreeLogBuffer_CS (unsigned index) {
static void GetLogFilename (
unsigned index,
TimeDesc timeDesc,
wchar * filename,
wchar_t * filename,
unsigned chars
) {
StrPrintf(
@ -203,7 +203,7 @@ static bool OpenLogFile_CS (unsigned index) {
return true;
// Build filename
wchar filename[MAX_PATH];
wchar_t filename[MAX_PATH];
GetLogFilename(
index,
s_logTime[index],
@ -212,7 +212,7 @@ static bool OpenLogFile_CS (unsigned index) {
);
// Open file
qword fileTime;
uint64_t fileTime;
EFileError fileError;
bool fileExist = PathDoesFileExist(filename);
s_logFile[index] = AsyncFileOpen(
@ -236,7 +236,7 @@ static bool OpenLogFile_CS (unsigned index) {
// Seek to end of file
AsyncFileSeek(s_logFile[index], s_logWritePos[index], kFileSeekFromBegin);
// If this is a new file, write Byte Order Mark
// If this is a new file, write uint8_t Order Mark
if (!fileExist) {
static const char s_bom[] = "\xEF\xBB\xBF";
AsyncFileWrite(
@ -338,7 +338,7 @@ static unsigned FlushLogsTimerCallback (void *) {
//============================================================================
void AsyncLogInitialize (
const wchar logDirName[],
const wchar_t logDirName[],
bool breakOnErrors
) {
s_running = true;
@ -411,9 +411,9 @@ void LogBreakOnErrors (bool breakOnErrors) {
//============================================================================
void AsyncLogWriteMsg (
const wchar facility[],
const wchar_t facility[],
ELogSeverity severity,
const wchar msg[]
const wchar_t msg[]
) {
if (!s_running)
return;
@ -472,7 +472,7 @@ void AsyncLogWriteMsg (
}
//============================================================================
void AsyncLogGetDirectory (wchar * dest, unsigned destChars) {
void AsyncLogGetDirectory (wchar_t * dest, unsigned destChars) {
ASSERT(dest);
StrCopy(dest, s_directory, destChars);
}

View File

@ -107,7 +107,7 @@ void ThreadDestroy (unsigned exitThreadWaitMs) {
void * AsyncThreadCreate (
FAsyncThreadProc threadProc,
void * argument,
const wchar name[]
const wchar_t name[]
) {
AsyncThread * thread = NEW(AsyncThread);
thread->proc = threadProc;