Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(831)

Unified Diff: core/src/fxcrt/fx_basic_wstring.cpp

Issue 1117263004: Make sure string constructors are efficient on literals (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« core/include/fxcrt/fx_string.h ('K') | « core/include/fxcrt/fx_string.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/src/fxcrt/fx_basic_wstring.cpp
diff --git a/core/src/fxcrt/fx_basic_wstring.cpp b/core/src/fxcrt/fx_basic_wstring.cpp
index 9b27537ed91ac3780ada197c7fe3d3469270c333..3465b4a926bfebeefcb2d116884933d10bae0d89 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);
« core/include/fxcrt/fx_string.h ('K') | « core/include/fxcrt/fx_string.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698