} else {
pNewBuffer = FX_Alloc(FX_BYTE, new_size);
}
- if (pNewBuffer) {
- m_pBuffer = pNewBuffer;
- m_AllocSize = new_size;
- }
+ m_pBuffer = pNewBuffer;
+ m_AllocSize = new_size;
}
void CFX_BinaryBuf::CopyData(const void* pStr, FX_STRSIZE size)
{
}
CFX_ByteTextBuf& CFX_ByteTextBuf::operator << (FX_BSTR lpsz)
{
- AppendBlock((FX_LPCBYTE)lpsz, lpsz.GetLength());
+ AppendBlock(lpsz.GetPtr(), lpsz.GetLength());
return *this;
}
CFX_ByteTextBuf& CFX_ByteTextBuf::operator << (int i)
{
char buf[32];
FXSYS_itoa(i, buf, 10);
- AppendBlock(buf, (FX_STRSIZE)FXSYS_strlen(buf));
+ AppendBlock(buf, FXSYS_strlen(buf));
return *this;
}
CFX_ByteTextBuf& CFX_ByteTextBuf::operator << (FX_DWORD i)
{
char buf[32];
FXSYS_itoa(i, buf, 10);
- AppendBlock(buf, (FX_STRSIZE)FXSYS_strlen(buf));
+ AppendBlock(buf, FXSYS_strlen(buf));
return *this;
}
CFX_ByteTextBuf& CFX_ByteTextBuf::operator << (double f)
}
void CFX_ByteTextBuf::operator =(const CFX_ByteStringC& str)
{
- CopyData((FX_LPCBYTE)str, str.GetLength());
+ CopyData(str.GetPtr(), str.GetLength());
}
void CFX_WideTextBuf::AppendChar(FX_WCHAR ch)
{
}
CFX_WideTextBuf& CFX_WideTextBuf::operator << (const CFX_WideString &str)
{
- AppendBlock((FX_LPCWSTR)str, str.GetLength() * sizeof(FX_WCHAR));
+ AppendBlock(str.c_str(), str.GetLength() * sizeof(FX_WCHAR));
return *this;
}
CFX_WideTextBuf& CFX_WideTextBuf::operator << (int i)
{
char buf[32];
FXSYS_itoa(i, buf, 10);
- FX_STRSIZE len = (FX_STRSIZE)FXSYS_strlen(buf);
+ FX_STRSIZE len = FXSYS_strlen(buf);
if (m_AllocSize < m_DataSize + (FX_STRSIZE)(len * sizeof(FX_WCHAR))) {
ExpandBuf(len * sizeof(FX_WCHAR));
}
}
CFX_WideTextBuf& CFX_WideTextBuf::operator << (FX_LPCWSTR lpsz)
{
- AppendBlock(lpsz, (FX_STRSIZE)FXSYS_wcslen(lpsz)*sizeof(FX_WCHAR));
+ AppendBlock(lpsz, FXSYS_wcslen(lpsz)*sizeof(FX_WCHAR));
return *this;
}
CFX_WideTextBuf& CFX_WideTextBuf::operator << (const CFX_WideTextBuf& buf)
int len = bstr.GetLength();
if (m_pStream) {
m_pStream->WriteBlock(&len, sizeof(int));
- m_pStream->WriteBlock(bstr, len);
+ m_pStream->WriteBlock(bstr.GetPtr(), len);
} else {
m_SavingBuf.AppendBlock(&len, sizeof(int));
- m_SavingBuf.AppendBlock(bstr, len);
+ m_SavingBuf.AppendBlock(bstr.GetPtr(), len);
}
return *this;
}
CFX_ArchiveSaver& CFX_ArchiveSaver::operator << (FX_LPCWSTR wstr)
{
- FX_STRSIZE len = (FX_STRSIZE)FXSYS_wcslen(wstr);
+ FX_STRSIZE len = FXSYS_wcslen(wstr);
if (m_pStream) {
m_pStream->WriteBlock(&len, sizeof(int));
m_pStream->WriteBlock(wstr, len);
{
CFX_ByteString encoded;
operator >> (encoded);
- str = CFX_WideString::FromUTF16LE((const unsigned short*)(FX_LPCSTR)encoded, encoded.GetLength());
+ str = CFX_WideString::FromUTF16LE((const unsigned short*)encoded.c_str(), encoded.GetLength());
return *this;
}
FX_BOOL CFX_ArchiveLoader::Read(void* pBuf, FX_DWORD dwSize)
}
if (!m_pBuffer) {
m_pBuffer = FX_Alloc(FX_BYTE, m_BufSize);
- if (!m_pBuffer) {
- return -1;
- }
}
FX_LPBYTE buffer = (FX_LPBYTE)pBuf;
FX_STRSIZE temp_size = (FX_STRSIZE)size;
}
FX_INT32 IFX_BufferArchive::AppendString(FX_BSTR lpsz)
{
- return AppendBlock((FX_LPCBYTE)lpsz, lpsz.GetLength());
+ return AppendBlock(lpsz.GetPtr(), lpsz.GetLength());
}
CFX_FileBufferArchive::CFX_FileBufferArchive(FX_STRSIZE size)
: IFX_BufferArchive(size)