diff options
author | Tom Sepez <tsepez@chromium.org> | 2018-08-07 20:17:23 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-08-07 20:17:23 +0000 |
commit | e1c2f6d7fe7a50280161832799550a3ee8f98088 (patch) | |
tree | 2850100c01fbd1fdf26f29aa574b2e59d71b3729 /fxjs/xfa/cjx_object.cpp | |
parent | 37ef9577dadc909c5affa6a6d6961557a7e73755 (diff) | |
download | pdfium-e1c2f6d7fe7a50280161832799550a3ee8f98088.tar.xz |
Remove WideString::Format() from ThrowException() methods.chromium/3516
No need for variadic printf-like functions, since callers can cobble
arguments into a string much more simply.
Change-Id: I0e8d6f6a55a3715ef9d5c6940b73ce8bb2220a1a
Reviewed-on: https://pdfium-review.googlesource.com/39611
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'fxjs/xfa/cjx_object.cpp')
-rw-r--r-- | fxjs/xfa/cjx_object.cpp | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/fxjs/xfa/cjx_object.cpp b/fxjs/xfa/cjx_object.cpp index 23e754d4b7..8684212ce2 100644 --- a/fxjs/xfa/cjx_object.cpp +++ b/fxjs/xfa/cjx_object.cpp @@ -178,9 +178,8 @@ CJS_Return CJX_Object::RunMethod( } void CJX_Object::ThrowTooManyOccurancesException(const WideString& obj) const { - ThrowException( - L"The element [%ls] has violated its allowable number of occurrences.", - obj.c_str()); + ThrowException(L"The element [" + obj + + L"] has violated its allowable number of occurrences."); } void CJX_Object::ThrowInvalidPropertyException() const { @@ -193,22 +192,17 @@ void CJX_Object::ThrowIndexOutOfBoundsException() const { void CJX_Object::ThrowParamCountMismatchException( const WideString& method) const { - ThrowException(L"Incorrect number of parameters calling method '%ls'.", - method.c_str()); + ThrowException(L"Incorrect number of parameters calling method '" + method + + L"'."); } void CJX_Object::ThrowArgumentMismatchException() const { ThrowException(L"Argument mismatch in property or function argument."); } -void CJX_Object::ThrowException(const wchar_t* str, ...) const { - va_list arg_ptr; - va_start(arg_ptr, str); - WideString wsMessage = WideString::FormatV(str, arg_ptr); - va_end(arg_ptr); - - ASSERT(!wsMessage.IsEmpty()); - FXJSE_ThrowMessage(wsMessage.UTF8Encode().AsStringView()); +void CJX_Object::ThrowException(const WideString& str) const { + ASSERT(!str.IsEmpty()); + FXJSE_ThrowMessage(str.UTF8Encode().AsStringView()); } bool CJX_Object::HasAttribute(XFA_Attribute eAttr) { |