summaryrefslogtreecommitdiff
path: root/core/src/fxcrt/fx_basic_bstring.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/fxcrt/fx_basic_bstring.cpp')
-rw-r--r--core/src/fxcrt/fx_basic_bstring.cpp72
1 files changed, 36 insertions, 36 deletions
diff --git a/core/src/fxcrt/fx_basic_bstring.cpp b/core/src/fxcrt/fx_basic_bstring.cpp
index 78698fc6d0..2baeb83b5d 100644
--- a/core/src/fxcrt/fx_basic_bstring.cpp
+++ b/core/src/fxcrt/fx_basic_bstring.cpp
@@ -22,7 +22,7 @@ static int _Buffer_itoa(char* buf, int i, FX_DWORD flags)
u = -i;
}
int base = 10;
- FX_LPCSTR string = "0123456789abcdef";
+ const FX_CHAR* string = "0123456789abcdef";
if (flags & FXFORMAT_HEX) {
base = 16;
if (flags & FXFORMAT_CAPITAL) {
@@ -81,7 +81,7 @@ CFX_ByteString::~CFX_ByteString()
m_pData->Release();
}
}
-CFX_ByteString::CFX_ByteString(FX_LPCSTR lpsz, FX_STRSIZE nLen)
+CFX_ByteString::CFX_ByteString(const FX_CHAR* lpsz, FX_STRSIZE nLen)
{
if (nLen < 0) {
nLen = lpsz ? FXSYS_strlen(lpsz) : 0;
@@ -95,7 +95,7 @@ CFX_ByteString::CFX_ByteString(FX_LPCSTR lpsz, FX_STRSIZE nLen)
m_pData = NULL;
}
}
-CFX_ByteString::CFX_ByteString(FX_LPCBYTE lpsz, FX_STRSIZE nLen)
+CFX_ByteString::CFX_ByteString(const uint8_t* lpsz, FX_STRSIZE nLen)
{
if (nLen > 0) {
m_pData = StringData::Create(nLen);
@@ -150,7 +150,7 @@ CFX_ByteString::CFX_ByteString(FX_BSTR str1, FX_BSTR str2)
FXSYS_memcpy32(m_pData->m_String + str1.GetLength(), str2.GetCStr(), str2.GetLength());
}
}
-const CFX_ByteString& CFX_ByteString::operator=(FX_LPCSTR lpsz)
+const CFX_ByteString& CFX_ByteString::operator=(const FX_CHAR* lpsz)
{
if (lpsz == NULL || lpsz[0] == 0) {
Empty();
@@ -192,7 +192,7 @@ const CFX_ByteString& CFX_ByteString::operator=(const CFX_BinaryBuf& buf)
Load(buf.GetBuffer(), buf.GetSize());
return *this;
}
-void CFX_ByteString::Load(FX_LPCBYTE buf, FX_STRSIZE len)
+void CFX_ByteString::Load(const uint8_t* buf, FX_STRSIZE len)
{
Empty();
if (len) {
@@ -204,7 +204,7 @@ void CFX_ByteString::Load(FX_LPCBYTE buf, FX_STRSIZE len)
m_pData = NULL;
}
}
-const CFX_ByteString& CFX_ByteString::operator+=(FX_LPCSTR lpsz)
+const CFX_ByteString& CFX_ByteString::operator+=(const FX_CHAR* lpsz)
{
if (lpsz) {
ConcatInPlace(FXSYS_strlen(lpsz), lpsz);
@@ -280,8 +280,8 @@ bool CFX_ByteString::EqualNoCase(FX_BSTR str) const
if (m_pData->m_nDataLength != len) {
return false;
}
- FX_LPCBYTE pThis = (FX_LPCBYTE)m_pData->m_String;
- FX_LPCBYTE pThat = str.GetPtr();
+ const uint8_t* pThis = (const uint8_t*)m_pData->m_String;
+ const uint8_t* pThat = str.GetPtr();
for (FX_STRSIZE i = 0; i < len; i ++) {
if ((*pThis) != (*pThat)) {
uint8_t bThis = *pThis;
@@ -301,7 +301,7 @@ bool CFX_ByteString::EqualNoCase(FX_BSTR str) const
}
return true;
}
-void CFX_ByteString::AssignCopy(FX_STRSIZE nSrcLen, FX_LPCSTR lpszSrcData)
+void CFX_ByteString::AssignCopy(FX_STRSIZE nSrcLen, const FX_CHAR* lpszSrcData)
{
AllocBeforeWrite(nSrcLen);
FXSYS_memcpy32(m_pData->m_String, lpszSrcData, nSrcLen);
@@ -336,7 +336,7 @@ void CFX_ByteString::ReleaseBuffer(FX_STRSIZE nNewLength)
}
CopyBeforeWrite();
if (nNewLength == -1) {
- nNewLength = FXSYS_strlen((FX_LPCSTR)m_pData->m_String);
+ nNewLength = FXSYS_strlen((const FX_CHAR*)m_pData->m_String);
}
if (nNewLength == 0) {
Empty();
@@ -351,7 +351,7 @@ void CFX_ByteString::Reserve(FX_STRSIZE len)
GetBuffer(len);
ReleaseBuffer(GetLength());
}
-FX_LPSTR CFX_ByteString::GetBuffer(FX_STRSIZE nMinBufLength)
+FX_CHAR* CFX_ByteString::GetBuffer(FX_STRSIZE nMinBufLength)
{
if (m_pData == NULL && nMinBufLength == 0) {
return NULL;
@@ -405,7 +405,7 @@ FX_STRSIZE CFX_ByteString::Delete(FX_STRSIZE nIndex, FX_STRSIZE nCount)
}
return m_pData->m_nDataLength;
}
-void CFX_ByteString::ConcatInPlace(FX_STRSIZE nSrcLen, FX_LPCSTR lpszSrcData)
+void CFX_ByteString::ConcatInPlace(FX_STRSIZE nSrcLen, const FX_CHAR* lpszSrcData)
{
if (nSrcLen == 0 || lpszSrcData == NULL) {
return;
@@ -426,8 +426,8 @@ void CFX_ByteString::ConcatInPlace(FX_STRSIZE nSrcLen, FX_LPCSTR lpszSrcData)
m_pData->m_String[m_pData->m_nDataLength] = 0;
}
}
-void CFX_ByteString::ConcatCopy(FX_STRSIZE nSrc1Len, FX_LPCSTR lpszSrc1Data,
- FX_STRSIZE nSrc2Len, FX_LPCSTR lpszSrc2Data)
+void CFX_ByteString::ConcatCopy(FX_STRSIZE nSrc1Len, const FX_CHAR* lpszSrc1Data,
+ FX_STRSIZE nSrc2Len, const FX_CHAR* lpszSrc2Data)
{
int nNewLen = nSrc1Len + nSrc2Len;
if (nNewLen <= 0) {
@@ -486,7 +486,7 @@ void CFX_ByteString::AllocCopy(CFX_ByteString& dest, FX_STRSIZE nCopyLen, FX_STR
#define FORCE_ANSI 0x10000
#define FORCE_UNICODE 0x20000
#define FORCE_INT64 0x40000
-void CFX_ByteString::FormatV(FX_LPCSTR lpszFormat, va_list argList)
+void CFX_ByteString::FormatV(const FX_CHAR* lpszFormat, va_list argList)
{
va_list argListSave;
#if defined(__ARMCC_VERSION) || (!defined(_MSC_VER) && (_FX_CPU_ == _FX_X64_ || _FX_CPU_ == _FX_IA64_ || _FX_CPU_ == _FX_ARM64_)) || defined(__native_client__)
@@ -495,7 +495,7 @@ void CFX_ByteString::FormatV(FX_LPCSTR lpszFormat, va_list argList)
argListSave = argList;
#endif
int nMaxLen = 0;
- for (FX_LPCSTR lpsz = lpszFormat; *lpsz != 0; lpsz ++) {
+ for (const FX_CHAR* lpsz = lpszFormat; *lpsz != 0; lpsz ++) {
if (*lpsz != '%' || *(lpsz = lpsz + 1) == '%') {
nMaxLen += FXSYS_strlen(lpsz);
continue;
@@ -579,7 +579,7 @@ void CFX_ByteString::FormatV(FX_LPCSTR lpszFormat, va_list argList)
va_arg(argList, int);
break;
case 's': {
- FX_LPCSTR pstrNextArg = va_arg(argList, FX_LPCSTR);
+ const FX_CHAR* pstrNextArg = va_arg(argList, const FX_CHAR*);
if (pstrNextArg == NULL) {
nItemLen = 6;
} else {
@@ -591,7 +591,7 @@ void CFX_ByteString::FormatV(FX_LPCSTR lpszFormat, va_list argList)
}
break;
case 'S': {
- FX_LPWSTR pstrNextArg = va_arg(argList, FX_LPWSTR);
+ FX_WCHAR* pstrNextArg = va_arg(argList, FX_WCHAR*);
if (pstrNextArg == NULL) {
nItemLen = 6;
} else {
@@ -604,7 +604,7 @@ void CFX_ByteString::FormatV(FX_LPCSTR lpszFormat, va_list argList)
break;
case 's'|FORCE_ANSI:
case 'S'|FORCE_ANSI: {
- FX_LPCSTR pstrNextArg = va_arg(argList, FX_LPCSTR);
+ const FX_CHAR* pstrNextArg = va_arg(argList, const FX_CHAR*);
if (pstrNextArg == NULL) {
nItemLen = 6;
} else {
@@ -617,7 +617,7 @@ void CFX_ByteString::FormatV(FX_LPCSTR lpszFormat, va_list argList)
break;
case 's'|FORCE_UNICODE:
case 'S'|FORCE_UNICODE: {
- FX_LPWSTR pstrNextArg = va_arg(argList, FX_LPWSTR);
+ FX_WCHAR* pstrNextArg = va_arg(argList, FX_WCHAR*);
if (pstrNextArg == NULL) {
nItemLen = 6;
} else {
@@ -700,7 +700,7 @@ void CFX_ByteString::FormatV(FX_LPCSTR lpszFormat, va_list argList)
}
va_end(argListSave);
}
-void CFX_ByteString::Format(FX_LPCSTR lpszFormat, ...)
+void CFX_ByteString::Format(const FX_CHAR* lpszFormat, ...)
{
va_list argList;
va_start(argList, lpszFormat);
@@ -720,7 +720,7 @@ FX_STRSIZE CFX_ByteString::Insert(FX_STRSIZE nIndex, FX_CHAR ch)
nNewLength++;
if (m_pData == NULL || m_pData->m_nAllocLength < nNewLength) {
StringData* pOldData = m_pData;
- FX_LPCSTR pstr = m_pData->m_String;
+ const FX_CHAR* pstr = m_pData->m_String;
m_pData = StringData::Create(nNewLength);
if (!m_pData) {
return 0;
@@ -777,7 +777,7 @@ FX_STRSIZE CFX_ByteString::Find(FX_CHAR ch, FX_STRSIZE nStart) const
if (nStart >= nLength) {
return -1;
}
- FX_LPCSTR lpsz = FXSYS_strchr(m_pData->m_String + nStart, ch);
+ const FX_CHAR* lpsz = FXSYS_strchr(m_pData->m_String + nStart, ch);
return (lpsz == NULL) ? -1 : (int)(lpsz - m_pData->m_String);
}
FX_STRSIZE CFX_ByteString::ReverseFind(FX_CHAR ch) const
@@ -794,12 +794,12 @@ FX_STRSIZE CFX_ByteString::ReverseFind(FX_CHAR ch) const
}
return -1;
}
-FX_LPCSTR FX_strstr(FX_LPCSTR str1, int len1, FX_LPCSTR str2, int len2)
+const FX_CHAR* FX_strstr(const FX_CHAR* str1, int len1, const FX_CHAR* str2, int len2)
{
if (len2 > len1 || len2 == 0) {
return NULL;
}
- FX_LPCSTR end_ptr = str1 + len1 - len2;
+ const FX_CHAR* end_ptr = str1 + len1 - len2;
while (str1 <= end_ptr) {
int i = 0;
while (1) {
@@ -824,7 +824,7 @@ FX_STRSIZE CFX_ByteString::Find(FX_BSTR lpszSub, FX_STRSIZE nStart) const
if (nStart > nLength) {
return -1;
}
- FX_LPCSTR lpsz = FX_strstr(m_pData->m_String + nStart, m_pData->m_nDataLength - nStart,
+ const FX_CHAR* lpsz = FX_strstr(m_pData->m_String + nStart, m_pData->m_nDataLength - nStart,
lpszSub.GetCStr(), lpszSub.GetLength());
return (lpsz == NULL) ? -1 : (int)(lpsz - m_pData->m_String);
}
@@ -859,9 +859,9 @@ FX_STRSIZE CFX_ByteString::Remove(FX_CHAR chRemove)
if (GetLength() < 1) {
return 0;
}
- FX_LPSTR pstrSource = m_pData->m_String;
- FX_LPSTR pstrDest = m_pData->m_String;
- FX_LPSTR pstrEnd = m_pData->m_String + m_pData->m_nDataLength;
+ FX_CHAR* pstrSource = m_pData->m_String;
+ FX_CHAR* pstrDest = m_pData->m_String;
+ FX_CHAR* pstrEnd = m_pData->m_String + m_pData->m_nDataLength;
while (pstrSource < pstrEnd) {
if (*pstrSource != chRemove) {
*pstrDest = *pstrSource;
@@ -885,10 +885,10 @@ FX_STRSIZE CFX_ByteString::Replace(FX_BSTR lpszOld, FX_BSTR lpszNew)
FX_STRSIZE nSourceLen = lpszOld.GetLength();
FX_STRSIZE nReplacementLen = lpszNew.GetLength();
FX_STRSIZE nCount = 0;
- FX_LPCSTR pStart = m_pData->m_String;
- FX_LPSTR pEnd = m_pData->m_String + m_pData->m_nDataLength;
+ const FX_CHAR* pStart = m_pData->m_String;
+ FX_CHAR* pEnd = m_pData->m_String + m_pData->m_nDataLength;
while (1) {
- FX_LPCSTR pTarget = FX_strstr(pStart, (FX_STRSIZE)(pEnd - pStart), lpszOld.GetCStr(), nSourceLen);
+ const FX_CHAR* pTarget = FX_strstr(pStart, (FX_STRSIZE)(pEnd - pStart), lpszOld.GetCStr(), nSourceLen);
if (pTarget == NULL) {
break;
}
@@ -908,9 +908,9 @@ FX_STRSIZE CFX_ByteString::Replace(FX_BSTR lpszOld, FX_BSTR lpszNew)
return 0;
}
pStart = m_pData->m_String;
- FX_LPSTR pDest = pNewData->m_String;
+ FX_CHAR* pDest = pNewData->m_String;
for (FX_STRSIZE i = 0; i < nCount; i ++) {
- FX_LPCSTR pTarget = FX_strstr(pStart, (FX_STRSIZE)(pEnd - pStart), lpszOld.GetCStr(), nSourceLen);
+ const FX_CHAR* pTarget = FX_strstr(pStart, (FX_STRSIZE)(pEnd - pStart), lpszOld.GetCStr(), nSourceLen);
FXSYS_memcpy32(pDest, pStart, pTarget - pStart);
pDest += pTarget - pStart;
FXSYS_memcpy32(pDest, lpszNew.GetCStr(), lpszNew.GetLength());
@@ -940,7 +940,7 @@ CFX_WideString CFX_ByteString::UTF8Decode() const
}
return decoder.GetResult();
}
-CFX_ByteString CFX_ByteString::FromUnicode(FX_LPCWSTR str, FX_STRSIZE len)
+CFX_ByteString CFX_ByteString::FromUnicode(const FX_WCHAR* str, FX_STRSIZE len)
{
if (len < 0) {
len = FXSYS_wcslen(str);
@@ -1078,7 +1078,7 @@ FX_DWORD CFX_ByteStringC::GetID(FX_STRSIZE start_pos) const
}
return strid;
}
-FX_STRSIZE FX_ftoa(FX_FLOAT d, FX_LPSTR buf)
+FX_STRSIZE FX_ftoa(FX_FLOAT d, FX_CHAR* buf)
{
buf[0] = '0';
buf[1] = '\0';