diff options
author | tsepez <tsepez@chromium.org> | 2016-05-16 12:03:24 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-05-16 12:03:24 -0700 |
commit | 3f80c864d5318d4d80ac811d42c92d8f63e0b5ac (patch) | |
tree | efc4acca871bfb2fb1af80f5ee5779ac6ef70034 /xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp | |
parent | b22504a8c589ff39a1d6eaa83dcd3ead454d3443 (diff) | |
download | pdfium-3f80c864d5318d4d80ac811d42c92d8f63e0b5ac.tar.xz |
Remove some c_str() calls from StringCs in xfa docs.
Avoids the risk of possibly getting a non-null terminated
buffer if the StringC happened to be created by Mid(), etc.
Doesn't seem to happen in practice.
Review-Url: https://codereview.chromium.org/1983683003
Diffstat (limited to 'xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp')
-rw-r--r-- | xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp b/xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp index e6de66d803..94fa8db96c 100644 --- a/xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp +++ b/xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp @@ -290,7 +290,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_GotoURL( CFX_ByteString bsURL = pArguments->GetUTF8String(0); wsURL = CFX_WideString::FromUTF8(bsURL.AsStringC()); } - pNotify->GetDocProvider()->GotoURL(hDoc, wsURL.AsStringC()); + pNotify->GetDocProvider()->GotoURL(hDoc, wsURL); } void CScript_HostPseudoModel::Script_HostPseudoModel_OpenList( CFXJSE_Arguments* pArguments) { @@ -381,10 +381,8 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_Response( if (iLength >= 4) { bMark = pArguments->GetInt32(3) == 0 ? FALSE : TRUE; } - CFX_WideString wsAnswer; - pNotify->GetAppProvider()->Response(wsAnswer, wsQuestion.AsStringC(), - wsTitle.AsStringC(), - wsDefaultAnswer.AsStringC(), bMark); + CFX_WideString wsAnswer = pNotify->GetAppProvider()->Response( + wsQuestion, wsTitle, wsDefaultAnswer, bMark); FXJSE_HVALUE hValue = pArguments->GetReturnValue(); if (hValue) { FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsAnswer).AsStringC()); @@ -598,7 +596,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_MessageBox( } } int32_t iValue = pNotify->GetAppProvider()->MsgBox( - wsMessage.AsStringC(), bsTitle.AsStringC(), dwMessageType, dwButtonType); + wsMessage, bsTitle, dwMessageType, dwButtonType); FXJSE_HVALUE hValue = pArguments->GetReturnValue(); if (hValue) { FXJSE_Value_SetInteger(hValue, iValue); @@ -730,7 +728,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_ImportData( wsFilePath = CFX_WideString::FromUTF8(bsFilePath.AsStringC()); } CXFA_FFDoc* hDoc = pNotify->GetHDOC(); - pNotify->GetDocProvider()->ImportData(hDoc, wsFilePath.AsStringC()); + pNotify->GetDocProvider()->ImportData(hDoc, wsFilePath); } void CScript_HostPseudoModel::Script_HostPseudoModel_ExportData( CFXJSE_Arguments* pArguments) { @@ -753,7 +751,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_ExportData( if (iLength >= 2) { bXDP = pArguments->GetInt32(1) == 0 ? FALSE : TRUE; } - pNotify->GetDocProvider()->ExportData(hDoc, wsFilePath.AsStringC(), bXDP); + pNotify->GetDocProvider()->ExportData(hDoc, wsFilePath, bXDP); } void CScript_HostPseudoModel::Script_HostPseudoModel_PageUp( CFXJSE_Arguments* pArguments) { |