diff options
author | tsepez <tsepez@chromium.org> | 2016-04-06 10:51:14 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-04-06 10:51:14 -0700 |
commit | 6fe7d2174a47107578da912299c93b4dfb9f2add (patch) | |
tree | 4f2d343c477c9a4ec18d25801800eb08d8938dad /xfa/fxfa/parser/xfa_script_imp.cpp | |
parent | 89bdd0876e6b92c959839908204eb82337a27ba2 (diff) | |
download | pdfium-6fe7d2174a47107578da912299c93b4dfb9f2add.tar.xz |
Make CFX_WideString::FromUTF8() take a CFX_ByteStringC argument.
Methods that take string arguments and do not persist them should
take *StringC types as argument rather than discrete ptr/len args.
Avoids a number of implicit casts from CFX_ByteString to char*.
BUG=
Review URL: https://codereview.chromium.org/1861183002
Diffstat (limited to 'xfa/fxfa/parser/xfa_script_imp.cpp')
-rw-r--r-- | xfa/fxfa/parser/xfa_script_imp.cpp | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/xfa/fxfa/parser/xfa_script_imp.cpp b/xfa/fxfa/parser/xfa_script_imp.cpp index 0b5cb1d156..e0536fc136 100644 --- a/xfa/fxfa/parser/xfa_script_imp.cpp +++ b/xfa/fxfa/parser/xfa_script_imp.cpp @@ -115,8 +115,7 @@ void CXFA_ScriptContext::GlobalPropertySetter(FXJSE_HOBJECT hObject, CXFA_ScriptContext* lpScriptContext = (CXFA_ScriptContext*)pDoc->GetScriptContext(); CXFA_Object* lpCurNode = lpScriptContext->GetVariablesThis(lpOrginalNode); - CFX_WideString wsPropName = CFX_WideString::FromUTF8( - (const FX_CHAR*)szPropName.raw_str(), szPropName.GetLength()); + CFX_WideString wsPropName = CFX_WideString::FromUTF8(szPropName); uint32_t dwFlag = XFA_RESOLVENODE_Parent | XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Attributes; @@ -174,8 +173,7 @@ void CXFA_ScriptContext::GlobalPropertyGetter(FXJSE_HOBJECT hObject, CXFA_ScriptContext* lpScriptContext = (CXFA_ScriptContext*)pDoc->GetScriptContext(); CXFA_Object* lpCurNode = lpScriptContext->GetVariablesThis(pOrginalObject); - CFX_WideString wsPropName = CFX_WideString::FromUTF8( - (const FX_CHAR*)szPropName.raw_str(), szPropName.GetLength()); + CFX_WideString wsPropName = CFX_WideString::FromUTF8(szPropName); if (lpScriptContext->GetType() == XFA_SCRIPTLANGTYPE_Formcalc) { if (szPropName == FOXIT_XFA_FM2JS_FORMCALC_RUNTIME) { XFA_FM2JS_GlobalPropertyGetter(lpScriptContext->m_hFM2JSContext, hValue); @@ -230,8 +228,7 @@ void CXFA_ScriptContext::NormalPropertyGetter(FXJSE_HOBJECT hObject, FXJSE_Value_SetUndefined(hValue); return; } - CFX_WideString wsPropName = CFX_WideString::FromUTF8( - (const FX_CHAR*)szPropName.raw_str(), szPropName.GetLength()); + CFX_WideString wsPropName = CFX_WideString::FromUTF8(szPropName); CXFA_ScriptContext* lpScriptContext = (CXFA_ScriptContext*)pOrginalObject->GetDocument()->GetScriptContext(); CXFA_Object* pObject = lpScriptContext->GetVariablesThis(pOrginalObject); @@ -279,8 +276,7 @@ void CXFA_ScriptContext::NormalPropertySetter(FXJSE_HOBJECT hObject, CXFA_ScriptContext* lpScriptContext = (CXFA_ScriptContext*)pOrginalObject->GetDocument()->GetScriptContext(); CXFA_Object* pObject = lpScriptContext->GetVariablesThis(pOrginalObject); - CFX_WideString wsPropName = CFX_WideString::FromUTF8( - (const FX_CHAR*)szPropName.raw_str(), szPropName.GetLength()); + CFX_WideString wsPropName = CFX_WideString::FromUTF8(szPropName); const XFA_SCRIPTATTRIBUTEINFO* lpAttributeInfo = XFA_GetScriptAttributeByName( pObject->GetClassID(), wsPropName.AsWideStringC()); if (lpAttributeInfo) { @@ -332,8 +328,7 @@ int32_t CXFA_ScriptContext::NormalPropTypeGetter( (CXFA_ScriptContext*)pObject->GetDocument()->GetScriptContext(); pObject = lpScriptContext->GetVariablesThis(pObject); XFA_ELEMENT objElement = pObject->GetClassID(); - CFX_WideString wsPropName = CFX_WideString::FromUTF8( - (const FX_CHAR*)szPropName.raw_str(), szPropName.GetLength()); + CFX_WideString wsPropName = CFX_WideString::FromUTF8(szPropName); if (XFA_GetMethodByName(objElement, wsPropName.AsWideStringC())) { return FXJSE_ClassPropType_Method; } @@ -355,8 +350,7 @@ int32_t CXFA_ScriptContext::GlobalPropTypeGetter( (CXFA_ScriptContext*)pObject->GetDocument()->GetScriptContext(); pObject = lpScriptContext->GetVariablesThis(pObject); XFA_ELEMENT objElement = pObject->GetClassID(); - CFX_WideString wsPropName = CFX_WideString::FromUTF8( - (const FX_CHAR*)szPropName.raw_str(), szPropName.GetLength()); + CFX_WideString wsPropName = CFX_WideString::FromUTF8(szPropName); if (XFA_GetMethodByName(objElement, wsPropName.AsWideStringC())) { return FXJSE_ClassPropType_Method; } @@ -372,8 +366,7 @@ void CXFA_ScriptContext::NormalMethodCall(FXJSE_HOBJECT hThis, CXFA_ScriptContext* lpScriptContext = (CXFA_ScriptContext*)pObject->GetDocument()->GetScriptContext(); pObject = lpScriptContext->GetVariablesThis(pObject); - CFX_WideString wsFunName = CFX_WideString::FromUTF8( - (const FX_CHAR*)szFuncName.raw_str(), szFuncName.GetLength()); + CFX_WideString wsFunName = CFX_WideString::FromUTF8(szFuncName); const XFA_METHODINFO* lpMethodInfo = XFA_GetMethodByName(pObject->GetClassID(), wsFunName.AsWideStringC()); if (NULL == lpMethodInfo) { |