summaryrefslogtreecommitdiff
path: root/core/src/fxcrt/fx_basic_wstring.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-05-05 15:51:17 -0700
committerTom Sepez <tsepez@chromium.org>2015-05-05 15:51:17 -0700
commit997bc0e2b4fd3f43b17b9bfcec8a9cac2283cb1d (patch)
treece7456ab7049d7ff4e592f2918c6cdec334a8694 /core/src/fxcrt/fx_basic_wstring.cpp
parent3d33c90cfed96a8e5ce707a025e8efd59ce1ca01 (diff)
downloadpdfium-997bc0e2b4fd3f43b17b9bfcec8a9cac2283cb1d.tar.xz
Merge to XFA: Make sure string constructors are efficient on literals
Besides the merge, there's one place where a wchar vs. wstring comparison was being made that no longer compiled. Original Review URL: https://codereview.chromium.org/1117263004 BUG=pdfium:151 R=thestig@chromium.org Review URL: https://codereview.chromium.org/1116163003
Diffstat (limited to 'core/src/fxcrt/fx_basic_wstring.cpp')
-rw-r--r--core/src/fxcrt/fx_basic_wstring.cpp28
1 files changed, 13 insertions, 15 deletions
diff --git a/core/src/fxcrt/fx_basic_wstring.cpp b/core/src/fxcrt/fx_basic_wstring.cpp
index 9b27537ed9..3465b4a926 100644
--- a/core/src/fxcrt/fx_basic_wstring.cpp
+++ b/core/src/fxcrt/fx_basic_wstring.cpp
@@ -63,21 +63,6 @@ CFX_WideString::~CFX_WideString()
FX_Free(m_pData);
}
}
-void CFX_WideString::InitStr(FX_LPCWSTR lpsz, FX_STRSIZE nLen)
-{
- if (nLen < 0) {
- nLen = lpsz ? (FX_STRSIZE)FXSYS_wcslen(lpsz) : 0;
- }
- if (nLen) {
- m_pData = FX_AllocStringW(nLen);
- if (!m_pData) {
- return;
- }
- FXSYS_memcpy32(m_pData->m_String, lpsz, nLen * sizeof(FX_WCHAR));
- } else {
- m_pData = NULL;
- }
-}
CFX_WideString::CFX_WideString(const CFX_WideString& stringSrc)
{
if (stringSrc.m_pData == NULL) {
@@ -92,6 +77,19 @@ CFX_WideString::CFX_WideString(const CFX_WideString& stringSrc)
*this = stringSrc;
}
}
+CFX_WideString::CFX_WideString(FX_LPCWSTR lpsz, FX_STRSIZE nLen) {
+ if (nLen < 0) {
+ nLen = lpsz ? (FX_STRSIZE)FXSYS_wcslen(lpsz) : 0;
+ }
+ if (nLen) {
+ m_pData = FX_AllocStringW(nLen);
+ if (m_pData) {
+ FXSYS_memcpy32(m_pData->m_String, lpsz, nLen * sizeof(FX_WCHAR));
+ }
+ } else {
+ m_pData = NULL;
+ }
+}
CFX_WideString::CFX_WideString(FX_WCHAR ch)
{
m_pData = FX_AllocStringW(1);