1
0

Fixed issues with int vs size_t and a few other warnings

This commit is contained in:
Tycho
2014-03-08 08:33:38 -08:00
parent 9b47366d03
commit 307fad0f25
10 changed files with 26 additions and 28 deletions

View File

@@ -177,15 +177,15 @@ bool cByteBuffer::Write(const char * a_Bytes, size_t a_Count)
CheckValid();
// Store the current free space for a check after writing:
int CurFreeSpace = GetFreeSpace();
int CurReadableSpace = GetReadableSpace();
int WrittenBytes = 0;
size_t CurFreeSpace = GetFreeSpace();
size_t CurReadableSpace = GetReadableSpace();
size_t WrittenBytes = 0;
if (CurFreeSpace < a_Count)
{
return false;
}
int TillEnd = m_BufferSize - m_WritePos;
size_t TillEnd = m_BufferSize - m_WritePos;
if (TillEnd <= a_Count)
{
// Need to wrap around the ringbuffer end
@@ -216,7 +216,7 @@ bool cByteBuffer::Write(const char * a_Bytes, size_t a_Count)
int cByteBuffer::GetFreeSpace(void) const
size_t cByteBuffer::GetFreeSpace(void) const
{
CHECK_THREAD;
CheckValid();
@@ -234,7 +234,7 @@ int cByteBuffer::GetFreeSpace(void) const
/// Returns the number of bytes that are currently in the ringbuffer. Note GetReadableBytes()
int cByteBuffer::GetUsedSpace(void) const
size_t cByteBuffer::GetUsedSpace(void) const
{
CHECK_THREAD;
CheckValid();
@@ -246,7 +246,7 @@ int cByteBuffer::GetUsedSpace(void) const
/// Returns the number of bytes that are currently available for reading (may be less than UsedSpace due to some data having been read already)
int cByteBuffer::GetReadableSpace(void) const
size_t cByteBuffer::GetReadableSpace(void) const
{
CHECK_THREAD;
CheckValid();
@@ -657,7 +657,7 @@ bool cByteBuffer::ReadBuf(void * a_Buffer, size_t a_Count)
ASSERT(a_Count >= 0);
NEEDBYTES(a_Count);
char * Dst = (char *)a_Buffer; // So that we can do byte math
int BytesToEndOfBuffer = m_BufferSize - m_ReadPos;
size_t BytesToEndOfBuffer = m_BufferSize - m_ReadPos;
ASSERT(BytesToEndOfBuffer >= 0); // Sanity check
if (BytesToEndOfBuffer <= a_Count)
{
@@ -691,7 +691,7 @@ bool cByteBuffer::WriteBuf(const void * a_Buffer, size_t a_Count)
ASSERT(a_Count >= 0);
PUTBYTES(a_Count);
char * Src = (char *)a_Buffer; // So that we can do byte math
int BytesToEndOfBuffer = m_BufferSize - m_WritePos;
size_t BytesToEndOfBuffer = m_BufferSize - m_WritePos;
if (BytesToEndOfBuffer <= a_Count)
{
// Reading across the ringbuffer end, read the first part and adjust parameters:
@@ -722,7 +722,7 @@ bool cByteBuffer::ReadString(AString & a_String, size_t a_Count)
NEEDBYTES(a_Count);
a_String.clear();
a_String.reserve(a_Count);
int BytesToEndOfBuffer = m_BufferSize - m_ReadPos;
size_t BytesToEndOfBuffer = m_BufferSize - m_ReadPos;
ASSERT(BytesToEndOfBuffer >= 0); // Sanity check
if (BytesToEndOfBuffer <= a_Count)
{