diff options
Diffstat (limited to 'core/fxcrt/bytestring.cpp')
-rw-r--r-- | core/fxcrt/bytestring.cpp | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/core/fxcrt/bytestring.cpp b/core/fxcrt/bytestring.cpp index 872de065ba..984acf9c69 100644 --- a/core/fxcrt/bytestring.cpp +++ b/core/fxcrt/bytestring.cpp @@ -11,6 +11,7 @@ #include <algorithm> #include <cctype> #include <string> +#include <utility> #include "core/fxcrt/cfx_utf8decoder.h" #include "core/fxcrt/fx_codepage.h" @@ -244,9 +245,16 @@ const ByteString& ByteString::operator=(const ByteStringView& stringSrc) { return *this; } -const ByteString& ByteString::operator=(const ByteString& stringSrc) { - if (m_pData != stringSrc.m_pData) - m_pData = stringSrc.m_pData; +const ByteString& ByteString::operator=(const ByteString& that) { + if (m_pData != that.m_pData) + m_pData = that.m_pData; + + return *this; +} + +const ByteString& ByteString::operator=(ByteString&& that) { + if (m_pData != that.m_pData) + m_pData = std::move(that.m_pData); return *this; } @@ -493,6 +501,10 @@ void ByteString::Concat(const char* pSrcData, size_t nSrcLen) { m_pData.Swap(pNewData); } +intptr_t ByteString::ReferenceCountForTesting() const { + return m_pData ? m_pData->m_nRefs : 0; +} + ByteString ByteString::Mid(size_t first, size_t count) const { if (!m_pData) return ByteString(); |