diff options
author | Ryan Harrison <rharrison@chromium.org> | 2017-07-27 16:28:44 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-07-27 21:05:23 +0000 |
commit | 33805cc811c722a0c5cd439cff419de252cd39c9 (patch) | |
tree | bb6ef4484ff62486e4cc0ea49642278b5da1b746 /xfa/fxfa/fm2js/cxfa_fmexpression.cpp | |
parent | 4191b03e29ef54f37deeadf652ee11cbfb81f9df (diff) | |
download | pdfium-33805cc811c722a0c5cd439cff419de252cd39c9.tar.xz |
Remove single param Mid() method from string classes
This support is being removed from CFX_ByteString, CFX_ByteStringC,
CFX_WideString, and CFX_WideStringC. This standardizes all of these
classes to only have one Mid method that takes in 2 params, offset and
count. Count now must be positive. The old behaviour of calculating
the length for the user if -1 is passed in for the count has been
removed. This work is in preperation for converting these classes to
not accept negative lengths anywhere and thus make the underlying size
type unsigned.
BUG=pdfium:828
Change-Id: I5f15e7b7b00b264231817f143e2da88ee6f69e7b
Reviewed-on: https://pdfium-review.googlesource.com/9430
Reviewed-by: (OOO Jul 28 - Aug 8) dsinclair <dsinclair@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Diffstat (limited to 'xfa/fxfa/fm2js/cxfa_fmexpression.cpp')
-rw-r--r-- | xfa/fxfa/fm2js/cxfa_fmexpression.cpp | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/xfa/fxfa/fm2js/cxfa_fmexpression.cpp b/xfa/fxfa/fm2js/cxfa_fmexpression.cpp index 7e6e0954aa..b201863b25 100644 --- a/xfa/fxfa/fm2js/cxfa_fmexpression.cpp +++ b/xfa/fxfa/fm2js/cxfa_fmexpression.cpp @@ -61,7 +61,8 @@ bool CXFA_FMFunctionDefinition::ToJavaScript(CFX_WideTextBuf& javascript) { } javascript << L"function "; if (m_wsName.GetAt(0) == L'!') { - CFX_WideString tempName = EXCLAMATION_IN_IDENTIFIER + m_wsName.Mid(1); + CFX_WideString tempName = + EXCLAMATION_IN_IDENTIFIER + m_wsName.Mid(1, m_wsName.GetLength() - 1); javascript << tempName; } else { javascript << m_wsName; @@ -73,7 +74,8 @@ bool CXFA_FMFunctionDefinition::ToJavaScript(CFX_WideTextBuf& javascript) { javascript << L", "; if (identifier.GetAt(0) == L'!') { CFX_WideString tempIdentifier = - EXCLAMATION_IN_IDENTIFIER + identifier.Mid(1); + EXCLAMATION_IN_IDENTIFIER + + identifier.Mid(1, identifier.GetLength() - 1); javascript << tempIdentifier; } else { javascript << identifier; @@ -127,7 +129,8 @@ bool CXFA_FMVarExpression::ToJavaScript(CFX_WideTextBuf& javascript) { javascript << L"var "; CFX_WideString tempName(m_wsName); if (m_wsName.GetAt(0) == L'!') { - tempName = EXCLAMATION_IN_IDENTIFIER + m_wsName.Mid(1); + tempName = + EXCLAMATION_IN_IDENTIFIER + m_wsName.Mid(1, m_wsName.GetLength() - 1); } javascript << tempName; javascript << L" = "; @@ -150,7 +153,8 @@ bool CXFA_FMVarExpression::ToImpliedReturnJS(CFX_WideTextBuf& javascript) { javascript << L"var "; CFX_WideString tempName(m_wsName); if (m_wsName.GetAt(0) == L'!') { - tempName = EXCLAMATION_IN_IDENTIFIER + m_wsName.Mid(1); + tempName = + EXCLAMATION_IN_IDENTIFIER + m_wsName.Mid(1, m_wsName.GetLength() - 1); } javascript << tempName; javascript << L" = "; @@ -456,7 +460,8 @@ bool CXFA_FMForExpression::ToJavaScript(CFX_WideTextBuf& javascript) { javascript << L"{\nvar "; CFX_WideString tempVariant; if (m_wsVariant.GetAt(0) == L'!') { - tempVariant = EXCLAMATION_IN_IDENTIFIER + m_wsVariant.Mid(1); + tempVariant = EXCLAMATION_IN_IDENTIFIER + + m_wsVariant.Mid(1, m_wsVariant.GetLength() - 1); javascript << tempVariant; } else { tempVariant = m_wsVariant; @@ -510,7 +515,8 @@ bool CXFA_FMForExpression::ToImpliedReturnJS(CFX_WideTextBuf& javascript) { javascript << L"{\nvar "; CFX_WideString tempVariant; if (m_wsVariant.GetAt(0) == L'!') { - tempVariant = EXCLAMATION_IN_IDENTIFIER + m_wsVariant.Mid(1); + tempVariant = EXCLAMATION_IN_IDENTIFIER + + m_wsVariant.Mid(1, m_wsVariant.GetLength() - 1); javascript << tempVariant; } else { tempVariant = m_wsVariant; @@ -576,7 +582,8 @@ bool CXFA_FMForeachExpression::ToJavaScript(CFX_WideTextBuf& javascript) { javascript << L"var "; if (m_wsIdentifier.GetAt(0) == L'!') { CFX_WideString tempIdentifier = - EXCLAMATION_IN_IDENTIFIER + m_wsIdentifier.Mid(1); + EXCLAMATION_IN_IDENTIFIER + + m_wsIdentifier.Mid(1, m_wsIdentifier.GetLength() - 1); javascript << tempIdentifier; } else { javascript << m_wsIdentifier; @@ -607,7 +614,8 @@ bool CXFA_FMForeachExpression::ToJavaScript(CFX_WideTextBuf& javascript) { javascript << L".length)\n{\n"; if (m_wsIdentifier.GetAt(0) == L'!') { CFX_WideString tempIdentifier = - EXCLAMATION_IN_IDENTIFIER + m_wsIdentifier.Mid(1); + EXCLAMATION_IN_IDENTIFIER + + m_wsIdentifier.Mid(1, m_wsIdentifier.GetLength() - 1); javascript << tempIdentifier; } else { javascript << m_wsIdentifier; @@ -631,7 +639,8 @@ bool CXFA_FMForeachExpression::ToImpliedReturnJS(CFX_WideTextBuf& javascript) { javascript << L"var "; if (m_wsIdentifier.GetAt(0) == L'!') { CFX_WideString tempIdentifier = - EXCLAMATION_IN_IDENTIFIER + m_wsIdentifier.Mid(1); + EXCLAMATION_IN_IDENTIFIER + + m_wsIdentifier.Mid(1, m_wsIdentifier.GetLength() - 1); javascript << tempIdentifier; } else { javascript << m_wsIdentifier; @@ -661,7 +670,8 @@ bool CXFA_FMForeachExpression::ToImpliedReturnJS(CFX_WideTextBuf& javascript) { javascript << L".length)\n{\n"; if (m_wsIdentifier.GetAt(0) == L'!') { CFX_WideString tempIdentifier = - EXCLAMATION_IN_IDENTIFIER + m_wsIdentifier.Mid(1); + EXCLAMATION_IN_IDENTIFIER + + m_wsIdentifier.Mid(1, m_wsIdentifier.GetLength() - 1); javascript << tempIdentifier; } else { javascript << m_wsIdentifier; |