summaryrefslogtreecommitdiff
path: root/xfa/fxfa/fm2js
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-05-13 17:21:31 -0700
committerCommit bot <commit-bot@chromium.org>2016-05-13 17:21:31 -0700
commitafe94306e3c542f0d499e7f7706ee5dec4028d8a (patch)
tree5012c9356cf1af259c74da3008dc7fcad439db2a /xfa/fxfa/fm2js
parent01e624fb699af3a8ee2f81620d59d366dac18f29 (diff)
downloadpdfium-afe94306e3c542f0d499e7f7706ee5dec4028d8a.tar.xz
Make CFX_WideString(const CFX_WideString&) explicit.
BUG= Review-Url: https://codereview.chromium.org/1979723003
Diffstat (limited to 'xfa/fxfa/fm2js')
-rw-r--r--xfa/fxfa/fm2js/xfa_expression.cpp4
-rw-r--r--xfa/fxfa/fm2js/xfa_fm2jscontext.cpp33
-rw-r--r--xfa/fxfa/fm2js/xfa_fmparse.cpp40
-rw-r--r--xfa/fxfa/fm2js/xfa_simpleexpression.cpp4
4 files changed, 37 insertions, 44 deletions
diff --git a/xfa/fxfa/fm2js/xfa_expression.cpp b/xfa/fxfa/fm2js/xfa_expression.cpp
index cecffb9112..72020c3f0c 100644
--- a/xfa/fxfa/fm2js/xfa_expression.cpp
+++ b/xfa/fxfa/fm2js/xfa_expression.cpp
@@ -122,7 +122,7 @@ CXFA_FMVarExpression::CXFA_FMVarExpression(uint32_t line,
void CXFA_FMVarExpression::ToJavaScript(CFX_WideTextBuf& javascript) {
javascript << FX_WSTRC(L"var ");
- CFX_WideString tempName = m_wsName;
+ CFX_WideString tempName(m_wsName);
if (m_wsName.GetAt(0) == L'!') {
tempName = EXCLAMATION_IN_IDENTIFIER + m_wsName.Mid(1);
}
@@ -143,7 +143,7 @@ void CXFA_FMVarExpression::ToJavaScript(CFX_WideTextBuf& javascript) {
void CXFA_FMVarExpression::ToImpliedReturnJS(CFX_WideTextBuf& javascript) {
javascript << FX_WSTRC(L"var ");
- CFX_WideString tempName = m_wsName;
+ CFX_WideString tempName(m_wsName);
if (m_wsName.GetAt(0) == L'!') {
tempName = EXCLAMATION_IN_IDENTIFIER + m_wsName.Mid(1);
}
diff --git a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp
index 852ea1bd6a..484191f1be 100644
--- a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp
+++ b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp
@@ -1583,7 +1583,7 @@ void CXFA_FM2JSContext::Time2Num(FXJSE_HOBJECT hThis,
pLocale = widgetData.GetLocal();
} else {
pLocale = pMgr->GetLocaleByName(
- CFX_WideString::FromUTF8(localString.AsStringC()).AsStringC());
+ CFX_WideString::FromUTF8(localString.AsStringC()));
}
CFX_WideString wsFormat;
if (formatString.IsEmpty()) {
@@ -2029,8 +2029,7 @@ FX_BOOL CXFA_FM2JSContext::Local2IsoDate(FXJSE_HOBJECT hThis,
CXFA_WidgetData widgetData(pThisNode);
pLocale = widgetData.GetLocal();
} else {
- pLocale =
- pMgr->GetLocaleByName(CFX_WideString::FromUTF8(szLocale).AsStringC());
+ pLocale = pMgr->GetLocaleByName(CFX_WideString::FromUTF8(szLocale));
}
if (!pLocale) {
return FALSE;
@@ -2066,8 +2065,7 @@ FX_BOOL CXFA_FM2JSContext::Local2IsoTime(FXJSE_HOBJECT hThis,
CXFA_WidgetData widgetData(pThisNode);
pLocale = widgetData.GetLocal();
} else {
- pLocale =
- pMgr->GetLocaleByName(CFX_WideString::FromUTF8(szLocale).AsStringC());
+ pLocale = pMgr->GetLocaleByName(CFX_WideString::FromUTF8(szLocale));
}
if (!pLocale) {
return FALSE;
@@ -2106,8 +2104,7 @@ FX_BOOL CXFA_FM2JSContext::IsoDate2Local(FXJSE_HOBJECT hThis,
CXFA_WidgetData widgetData(pThisNode);
pLocale = widgetData.GetLocal();
} else {
- pLocale =
- pMgr->GetLocaleByName(CFX_WideString::FromUTF8(szLocale).AsStringC());
+ pLocale = pMgr->GetLocaleByName(CFX_WideString::FromUTF8(szLocale));
}
if (!pLocale) {
return FALSE;
@@ -2145,8 +2142,7 @@ FX_BOOL CXFA_FM2JSContext::IsoTime2Local(FXJSE_HOBJECT hThis,
CXFA_WidgetData widgetData(pThisNode);
pLocale = widgetData.GetLocal();
} else {
- pLocale =
- pMgr->GetLocaleByName(CFX_WideString::FromUTF8(szLocale).AsStringC());
+ pLocale = pMgr->GetLocaleByName(CFX_WideString::FromUTF8(szLocale));
}
if (!pLocale) {
return FALSE;
@@ -2186,8 +2182,7 @@ FX_BOOL CXFA_FM2JSContext::GetGMTTime(FXJSE_HOBJECT hThis,
CXFA_WidgetData widgetData(pThisNode);
pLocale = widgetData.GetLocal();
} else {
- pLocale =
- pMgr->GetLocaleByName(CFX_WideString::FromUTF8(szLocale).AsStringC());
+ pLocale = pMgr->GetLocaleByName(CFX_WideString::FromUTF8(szLocale));
}
if (!pLocale) {
return FALSE;
@@ -2368,8 +2363,7 @@ void CXFA_FM2JSContext::GetLocalDateFormat(FXJSE_HOBJECT hThis,
CXFA_WidgetData widgetData(pThisNode);
pLocale = widgetData.GetLocal();
} else {
- pLocale =
- pMgr->GetLocaleByName(CFX_WideString::FromUTF8(szLocalStr).AsStringC());
+ pLocale = pMgr->GetLocaleByName(CFX_WideString::FromUTF8(szLocalStr));
}
if (!pLocale) {
return;
@@ -2423,8 +2417,7 @@ void CXFA_FM2JSContext::GetLocalTimeFormat(FXJSE_HOBJECT hThis,
CXFA_WidgetData widgetData(pThisNode);
pLocale = widgetData.GetLocal();
} else {
- pLocale =
- pMgr->GetLocaleByName(CFX_WideString::FromUTF8(szLocalStr).AsStringC());
+ pLocale = pMgr->GetLocaleByName(CFX_WideString::FromUTF8(szLocalStr));
}
if (!pLocale) {
return;
@@ -4388,10 +4381,10 @@ void CXFA_FM2JSContext::Format(FXJSE_HOBJECT hThis,
switch (patternType) {
case XFA_VT_DATETIME: {
FX_STRSIZE iTChar = wsPattern.Find(L'T');
- CFX_WideString wsDatePattern = FX_WSTRC(L"date{");
+ CFX_WideString wsDatePattern(L"date{");
wsDatePattern += wsPattern.Left(iTChar);
wsDatePattern += FX_WSTRC(L"} ");
- CFX_WideString wsTimePattern = FX_WSTRC(L"time{");
+ CFX_WideString wsTimePattern(L"time{");
wsTimePattern += wsPattern.Mid(iTChar + 1);
wsTimePattern += FX_WSTRC(L"}");
wsPattern = wsDatePattern + wsTimePattern;
@@ -4614,10 +4607,10 @@ void CXFA_FM2JSContext::Parse(FXJSE_HOBJECT hThis,
switch (patternType) {
case XFA_VT_DATETIME: {
FX_STRSIZE iTChar = wsPattern.Find(L'T');
- CFX_WideString wsDatePattern = FX_WSTRC(L"date{");
+ CFX_WideString wsDatePattern(L"date{");
wsDatePattern += wsPattern.Left(iTChar);
wsDatePattern += FX_WSTRC(L"} ");
- CFX_WideString wsTimePattern = FX_WSTRC(L"time{");
+ CFX_WideString wsTimePattern(L"time{");
wsTimePattern += wsPattern.Mid(iTChar + 1);
wsTimePattern += FX_WSTRC(L"}");
wsPattern = wsDatePattern + wsTimePattern;
@@ -6377,7 +6370,7 @@ void CXFA_FM2JSContext::eval_translation(FXJSE_HOBJECT hThis,
CFX_WideString wsError;
XFA_FM2JS_Translate(scriptString.AsStringC(), wsJavaScriptBuf, wsError);
if (wsError.IsEmpty()) {
- CFX_WideString javaScript = wsJavaScriptBuf.AsStringC();
+ CFX_WideString javaScript = wsJavaScriptBuf.MakeString();
FXJSE_Value_SetUTF8String(
args.GetReturnValue(),
FX_UTF8Encode(javaScript.c_str(), javaScript.GetLength())
diff --git a/xfa/fxfa/fm2js/xfa_fmparse.cpp b/xfa/fxfa/fm2js/xfa_fmparse.cpp
index 0a9fa81bad..efbf224a40 100644
--- a/xfa/fxfa/fm2js/xfa_fmparse.cpp
+++ b/xfa/fxfa/fm2js/xfa_fmparse.cpp
@@ -29,7 +29,7 @@ void CXFA_FMParse::NextToken() {
void CXFA_FMParse::Check(XFA_FM_TOKEN op) {
if (m_pToken->m_type != op) {
- CFX_WideString ws_TempString = m_pToken->m_wstring;
+ CFX_WideString ws_TempString(m_pToken->m_wstring);
Error(m_pToken->m_uLinenum, kFMErrExpectedToken, XFA_FM_KeywordToString(op),
ws_TempString.c_str());
}
@@ -82,7 +82,7 @@ CXFA_FMExpression* CXFA_FMParse::ParseFunction() {
uint32_t line = m_pToken->m_uLinenum;
NextToken();
if (m_pToken->m_type != TOKidentifier) {
- CFX_WideString ws_TempString = m_pToken->m_wstring;
+ CFX_WideString ws_TempString(m_pToken->m_wstring);
Error(m_pToken->m_uLinenum, kFMErrExpectedIdentifier,
ws_TempString.c_str());
} else {
@@ -111,7 +111,7 @@ CXFA_FMExpression* CXFA_FMParse::ParseFunction() {
break;
}
} else {
- CFX_WideString ws_TempString = m_pToken->m_wstring;
+ CFX_WideString ws_TempString(m_pToken->m_wstring);
Error(m_pToken->m_uLinenum, kFMErrExpectedIdentifier,
ws_TempString.c_str());
NextToken();
@@ -181,7 +181,7 @@ CXFA_FMExpression* CXFA_FMParse::ParseExpression() {
NextToken();
break;
default:
- CFX_WideString ws_TempString = m_pToken->m_wstring;
+ CFX_WideString ws_TempString(m_pToken->m_wstring);
Error(m_pToken->m_uLinenum, kFMErrUnexpectedExpression,
ws_TempString.c_str());
NextToken();
@@ -196,7 +196,7 @@ CXFA_FMExpression* CXFA_FMParse::ParseVarExpression() {
uint32_t line = m_pToken->m_uLinenum;
NextToken();
if (m_pToken->m_type != TOKidentifier) {
- CFX_WideString ws_TempString = m_pToken->m_wstring;
+ CFX_WideString ws_TempString(m_pToken->m_wstring);
Error(m_pToken->m_uLinenum, kFMErrExpectedIdentifier,
ws_TempString.c_str());
} else {
@@ -532,7 +532,7 @@ CXFA_FMSimpleExpression* CXFA_FMParse::ParsePrimaryExpression() {
e.reset(ParseParenExpression());
break;
default:
- CFX_WideString ws_TempString = m_pToken->m_wstring;
+ CFX_WideString ws_TempString(m_pToken->m_wstring);
Error(m_pToken->m_uLinenum, kFMErrUnexpectedExpression,
ws_TempString.c_str());
NextToken();
@@ -567,7 +567,7 @@ CXFA_FMSimpleExpression* CXFA_FMParse::ParsePostExpression(
}
}
if (m_pToken->m_type != TOKrparen) {
- CFX_WideString ws_TempString = m_pToken->m_wstring;
+ CFX_WideString ws_TempString(m_pToken->m_wstring);
Error(m_pToken->m_uLinenum, kFMErrExpectedToken,
XFA_FM_KeywordToString(TOKrparen), ws_TempString.c_str());
}
@@ -620,7 +620,7 @@ CXFA_FMSimpleExpression* CXFA_FMParse::ParsePostExpression(
}
}
if (m_pToken->m_type != TOKrparen) {
- CFX_WideString ws_TempString = m_pToken->m_wstring;
+ CFX_WideString ws_TempString(m_pToken->m_wstring);
Error(m_pToken->m_uLinenum, kFMErrExpectedToken,
XFA_FM_KeywordToString(TOKrparen), ws_TempString.c_str());
}
@@ -666,7 +666,7 @@ CXFA_FMSimpleExpression* CXFA_FMParse::ParsePostExpression(
continue;
}
} else {
- CFX_WideString ws_TempString = m_pToken->m_wstring;
+ CFX_WideString ws_TempString(m_pToken->m_wstring);
Error(m_pToken->m_uLinenum, kFMErrExpectedIdentifier,
ws_TempString.c_str());
return e;
@@ -694,7 +694,7 @@ CXFA_FMSimpleExpression* CXFA_FMParse::ParsePostExpression(
continue;
}
} else {
- CFX_WideString ws_TempString = m_pToken->m_wstring;
+ CFX_WideString ws_TempString(m_pToken->m_wstring);
Error(m_pToken->m_uLinenum, kFMErrExpectedIdentifier,
ws_TempString.c_str());
return e;
@@ -722,7 +722,7 @@ CXFA_FMSimpleExpression* CXFA_FMParse::ParsePostExpression(
continue;
}
} else {
- CFX_WideString ws_TempString = m_pToken->m_wstring;
+ CFX_WideString ws_TempString(m_pToken->m_wstring);
Error(m_pToken->m_uLinenum, kFMErrExpectedIdentifier,
ws_TempString.c_str());
return e;
@@ -753,7 +753,7 @@ CXFA_FMSimpleExpression* CXFA_FMParse::ParseIndexExpression() {
new CXFA_FMIndexExpression(line, accessorIndex, s.release(), TRUE));
NextToken();
if (m_pToken->m_type != TOKrbracket) {
- CFX_WideString ws_TempString = m_pToken->m_wstring;
+ CFX_WideString ws_TempString(m_pToken->m_wstring);
Error(m_pToken->m_uLinenum, kFMErrExpectedToken,
XFA_FM_KeywordToString(TOKrparen), ws_TempString.c_str());
pExp.reset();
@@ -769,7 +769,7 @@ CXFA_FMSimpleExpression* CXFA_FMParse::ParseIndexExpression() {
}
s.reset(ParseSimpleExpression());
if (m_pToken->m_type != TOKrbracket) {
- CFX_WideString ws_TempString = m_pToken->m_wstring;
+ CFX_WideString ws_TempString(m_pToken->m_wstring);
Error(m_pToken->m_uLinenum, kFMErrExpectedToken,
XFA_FM_KeywordToString(TOKrparen), ws_TempString.c_str());
} else {
@@ -891,7 +891,7 @@ CXFA_FMExpression* CXFA_FMParse::ParseIfExpression() {
Check(TOKendif);
break;
default:
- CFX_WideString ws_TempString = m_pToken->m_wstring;
+ CFX_WideString ws_TempString(m_pToken->m_wstring);
Error(m_pToken->m_uLinenum, kFMErrExpectedEndIf, ws_TempString.c_str());
NextToken();
break;
@@ -927,7 +927,7 @@ CXFA_FMSimpleExpression* CXFA_FMParse::ParseSubassignmentInForExpression() {
e.reset(ParseSimpleExpression());
break;
default:
- CFX_WideString ws_TempString = m_pToken->m_wstring;
+ CFX_WideString ws_TempString(m_pToken->m_wstring);
Error(m_pToken->m_uLinenum, kFMErrUnexpectedExpression,
ws_TempString.c_str());
NextToken();
@@ -941,7 +941,7 @@ CXFA_FMExpression* CXFA_FMParse::ParseForExpression() {
uint32_t line = m_pToken->m_uLinenum;
NextToken();
if (m_pToken->m_type != TOKidentifier) {
- CFX_WideString ws_TempString = m_pToken->m_wstring;
+ CFX_WideString ws_TempString(m_pToken->m_wstring);
Error(m_pToken->m_uLinenum, kFMErrExpectedToken,
XFA_FM_KeywordToString(m_pToken->m_type), ws_TempString.c_str());
}
@@ -952,7 +952,7 @@ CXFA_FMExpression* CXFA_FMParse::ParseForExpression() {
NextToken();
pAssignment.reset(ParseSimpleExpression());
} else {
- CFX_WideString ws_TempString = m_pToken->m_wstring;
+ CFX_WideString ws_TempString(m_pToken->m_wstring);
Error(m_pToken->m_uLinenum, kFMErrExpectedToken,
XFA_FM_KeywordToString(m_pToken->m_type), ws_TempString.c_str());
}
@@ -962,7 +962,7 @@ CXFA_FMExpression* CXFA_FMParse::ParseForExpression() {
} else if (m_pToken->m_type == TOKdownto) {
iDirection = -1;
} else {
- CFX_WideString ws_TempString = m_pToken->m_wstring;
+ CFX_WideString ws_TempString(m_pToken->m_wstring);
Error(m_pToken->m_uLinenum, kFMErrExpectedToken, L"upto or downto",
ws_TempString.c_str());
}
@@ -993,7 +993,7 @@ CXFA_FMExpression* CXFA_FMParse::ParseForeachExpression() {
uint32_t line = m_pToken->m_uLinenum;
NextToken();
if (m_pToken->m_type != TOKidentifier) {
- CFX_WideString ws_TempString = m_pToken->m_wstring;
+ CFX_WideString ws_TempString(m_pToken->m_wstring);
Error(m_pToken->m_uLinenum, kFMErrExpectedToken,
XFA_FM_KeywordToString(m_pToken->m_type), ws_TempString.c_str());
}
@@ -1002,7 +1002,7 @@ CXFA_FMExpression* CXFA_FMParse::ParseForeachExpression() {
Check(TOKin);
Check(TOKlparen);
if (m_pToken->m_type == TOKrparen) {
- CFX_WideString ws_TempString = m_pToken->m_wstring;
+ CFX_WideString ws_TempString(m_pToken->m_wstring);
Error(m_pToken->m_uLinenum, kFMErrUnexpectedExpression,
ws_TempString.c_str());
NextToken();
diff --git a/xfa/fxfa/fm2js/xfa_simpleexpression.cpp b/xfa/fxfa/fm2js/xfa_simpleexpression.cpp
index aad8f7bed0..e77623de3a 100644
--- a/xfa/fxfa/fm2js/xfa_simpleexpression.cpp
+++ b/xfa/fxfa/fm2js/xfa_simpleexpression.cpp
@@ -146,7 +146,7 @@ CXFA_FMStringExpression::CXFA_FMStringExpression(uint32_t line,
: CXFA_FMSimpleExpression(line, TOKstring), m_wsString(wsString) {}
void CXFA_FMStringExpression::ToJavaScript(CFX_WideTextBuf& javascript) {
- CFX_WideString tempStr = m_wsString;
+ CFX_WideString tempStr(m_wsString);
if (tempStr.GetLength() > 2) {
javascript.AppendChar(L'\"');
FX_WCHAR oneChar;
@@ -178,7 +178,7 @@ CXFA_FMIdentifierExpressionn::CXFA_FMIdentifierExpressionn(
m_wsIdentifier(wsIdentifier) {}
void CXFA_FMIdentifierExpressionn::ToJavaScript(CFX_WideTextBuf& javascript) {
- CFX_WideString tempStr = m_wsIdentifier;
+ CFX_WideString tempStr(m_wsIdentifier);
if (tempStr == FX_WSTRC(L"$")) {
tempStr = FX_WSTRC(L"this");
} else if (tempStr == FX_WSTRC(L"!")) {