summaryrefslogtreecommitdiff
path: root/fpdfsdk
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-04-08 09:00:35 -0700
committerCommit bot <commit-bot@chromium.org>2016-04-08 09:00:35 -0700
commit8b36e5cc3d5f5f579c6b060e2c40b896a4b02bc0 (patch)
treef84a20d330d92b791d0322f424cb155816d77d1b /fpdfsdk
parent8da140e8747920057a2f2bbcf5c78e40bb198733 (diff)
downloadpdfium-8b36e5cc3d5f5f579c6b060e2c40b896a4b02bc0.tar.xz
Make CFX_WideString::FromLocal() take a CFX_ByteStringC arg
It doesn't persist the string beyond the duration of the call, hence it should take the *StringC variant. Doing so avoids some allocs by changing to the *StringC ctor in a few places, at the cost of some explicit .ToByteStringC() calls (which are cheap). Review URL: https://codereview.chromium.org/1862953004
Diffstat (limited to 'fpdfsdk')
-rw-r--r--fpdfsdk/fsdk_mgr.cpp6
-rw-r--r--fpdfsdk/javascript/PublicMethods.cpp4
2 files changed, 5 insertions, 5 deletions
diff --git a/fpdfsdk/fsdk_mgr.cpp b/fpdfsdk/fsdk_mgr.cpp
index 6c7a8bb4b2..e6ad18d232 100644
--- a/fpdfsdk/fsdk_mgr.cpp
+++ b/fpdfsdk/fsdk_mgr.cpp
@@ -296,7 +296,7 @@ CFX_WideString CPDFDoc_Environment::JS_fieldBrowse() {
if (nActualLen <= 0 || nActualLen > nRequiredLen)
return CFX_WideString();
- return CFX_WideString::FromLocal(CFX_ByteString(pBuff.get(), nActualLen));
+ return CFX_WideString::FromLocal(CFX_ByteStringC(pBuff.get(), nActualLen));
}
CFX_WideString CPDFDoc_Environment::JS_docGetFilePath() {
@@ -316,7 +316,7 @@ CFX_WideString CPDFDoc_Environment::JS_docGetFilePath() {
if (nActualLen <= 0 || nActualLen > nRequiredLen)
return CFX_WideString();
- return CFX_WideString::FromLocal(CFX_ByteString(pBuff.get(), nActualLen));
+ return CFX_WideString::FromLocal(CFX_ByteStringC(pBuff.get(), nActualLen));
}
void CPDFDoc_Environment::JS_docSubmitForm(void* formData,
@@ -476,7 +476,7 @@ void CPDFSDK_Document::ProcJavascriptFun() {
CPDF_Action jsAction = docJS.GetJSAction(i, csJSName);
if (m_pEnv->GetActionHander())
m_pEnv->GetActionHander()->DoAction_JavaScript(
- jsAction, CFX_WideString::FromLocal(csJSName), this);
+ jsAction, CFX_WideString::FromLocal(csJSName.AsByteStringC()), this);
}
}
diff --git a/fpdfsdk/javascript/PublicMethods.cpp b/fpdfsdk/javascript/PublicMethods.cpp
index 308163d454..d5b961d61d 100644
--- a/fpdfsdk/javascript/PublicMethods.cpp
+++ b/fpdfsdk/javascript/PublicMethods.cpp
@@ -837,7 +837,7 @@ FX_BOOL CJS_PublicMethods::AFNumber_Format(IJS_Context* cc,
}
// for processing currency string
- Value = CFX_WideString::FromLocal(strValue);
+ Value = CFX_WideString::FromLocal(strValue.AsByteStringC());
std::wstring strValue2 = Value.c_str();
if (bCurrencyPrepend)
@@ -1120,7 +1120,7 @@ FX_BOOL CJS_PublicMethods::AFPercent_Format(
if (iNegative)
strValue = "-" + strValue;
strValue += "%";
- Value = CFX_WideString::FromLocal(strValue);
+ Value = CFX_WideString::FromLocal(strValue.AsByteStringC());
#endif
return TRUE;
}