summaryrefslogtreecommitdiff
path: root/core/fpdfdoc
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-09-13 06:46:40 -0700
committerCommit bot <commit-bot@chromium.org>2016-09-13 06:46:40 -0700
commit067990ccf96ae962392a2dbacbfd8348dc4c7676 (patch)
tree5e6a1d32d1b19bc2f7ff4197693d8612737342fc /core/fpdfdoc
parentbb8935e9def5ad865be613eebea597a77fc7c547 (diff)
downloadpdfium-067990ccf96ae962392a2dbacbfd8348dc4c7676.tar.xz
Stop converting widestring -> c_str -> widestring in several places.
Avoids a needless alloc and copy. Review-Url: https://codereview.chromium.org/2338553002
Diffstat (limited to 'core/fpdfdoc')
-rw-r--r--core/fpdfdoc/cpdf_variabletext.cpp3
-rw-r--r--core/fpdfdoc/cpvt_generateap.cpp8
-rw-r--r--core/fpdfdoc/include/cpdf_variabletext.h2
3 files changed, 6 insertions, 7 deletions
diff --git a/core/fpdfdoc/cpdf_variabletext.cpp b/core/fpdfdoc/cpdf_variabletext.cpp
index 040b7e6051..12cf274321 100644
--- a/core/fpdfdoc/cpdf_variabletext.cpp
+++ b/core/fpdfdoc/cpdf_variabletext.cpp
@@ -394,9 +394,8 @@ CPVT_WordPlace CPDF_VariableText::BackSpaceWord(const CPVT_WordPlace& place) {
return ClearLeftWord(AdjustLineHeader(place, TRUE));
}
-void CPDF_VariableText::SetText(const FX_WCHAR* text) {
+void CPDF_VariableText::SetText(const CFX_WideString& swText) {
DeleteWords(CPVT_WordRange(GetBeginWordPlace(), GetEndWordPlace()));
- CFX_WideString swText = text;
CPVT_WordPlace wp(0, 0, -1);
CPVT_SectionInfo secinfo;
if (CSection* pSection = m_SectionArray.GetAt(0))
diff --git a/core/fpdfdoc/cpvt_generateap.cpp b/core/fpdfdoc/cpvt_generateap.cpp
index 8c8cb9333c..741b2365f5 100644
--- a/core/fpdfdoc/cpvt_generateap.cpp
+++ b/core/fpdfdoc/cpvt_generateap.cpp
@@ -234,7 +234,7 @@ bool GenerateWidgetAP(CPDF_Document* pDoc,
vt.SetLimitChar(dwMaxLen);
vt.Initialize();
- vt.SetText(swValue.c_str());
+ vt.SetText(swValue);
vt.RearrangeAll();
CFX_FloatRect rcContent = vt.GetContentRect();
CFX_FloatPoint ptOffset(0.0f, 0.0f);
@@ -284,7 +284,7 @@ bool GenerateWidgetAP(CPDF_Document* pDoc,
vt.SetFontSize(fFontSize);
vt.Initialize();
- vt.SetText(swValue.c_str());
+ vt.SetText(swValue);
vt.RearrangeAll();
CFX_FloatRect rcContent = vt.GetContentRect();
CFX_FloatPoint ptOffset =
@@ -374,7 +374,7 @@ bool GenerateWidgetAP(CPDF_Document* pDoc,
vt.SetFontSize(IsFloatZero(fFontSize) ? 12.0f : fFontSize);
vt.Initialize();
- vt.SetText(swItem.c_str());
+ vt.SetText(swItem);
vt.RearrangeAll();
FX_FLOAT fItemHeight = vt.GetContentRect().Height();
if (bSelected) {
@@ -516,7 +516,7 @@ CFX_ByteString GetPopupContentsString(CPDF_Document* pDoc,
vt.SetMultiLine(TRUE);
vt.Initialize();
- vt.SetText(swValue.c_str());
+ vt.SetText(swValue);
vt.RearrangeAll();
CFX_FloatPoint ptOffset(3.0f, -3.0f);
CFX_ByteString sContent = CPVT_GenerateAP::GenerateEditAP(
diff --git a/core/fpdfdoc/include/cpdf_variabletext.h b/core/fpdfdoc/include/cpdf_variabletext.h
index fa5fe07dba..83e74b867e 100644
--- a/core/fpdfdoc/include/cpdf_variabletext.h
+++ b/core/fpdfdoc/include/cpdf_variabletext.h
@@ -108,7 +108,7 @@ class CPDF_VariableText {
void RearrangeAll();
void RearrangePart(const CPVT_WordRange& PlaceRange);
void ResetAll();
- void SetText(const FX_WCHAR* text);
+ void SetText(const CFX_WideString& text);
CPVT_WordPlace InsertWord(const CPVT_WordPlace& place,
uint16_t word,
int32_t charset,