From 8b36e5cc3d5f5f579c6b060e2c40b896a4b02bc0 Mon Sep 17 00:00:00 2001 From: tsepez Date: Fri, 8 Apr 2016 09:00:35 -0700 Subject: Make CFX_WideString::FromLocal() take a CFX_ByteStringC arg It doesn't persist the string beyond the duration of the call, hence it should take the *StringC variant. Doing so avoids some allocs by changing to the *StringC ctor in a few places, at the cost of some explicit .ToByteStringC() calls (which are cheap). Review URL: https://codereview.chromium.org/1862953004 --- core/fpdfdoc/doc_form.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'core/fpdfdoc/doc_form.cpp') diff --git a/core/fpdfdoc/doc_form.cpp b/core/fpdfdoc/doc_form.cpp index 80c09714a2..384bcaa435 100644 --- a/core/fpdfdoc/doc_form.cpp +++ b/core/fpdfdoc/doc_form.cpp @@ -35,12 +35,13 @@ CFX_WideString FPDFDOC_FDF_GetFieldValue(const CPDF_Dictionary& pFieldDict, const CFX_ByteString csBValue = pFieldDict.GetStringBy("V"); for (const auto& encoding : g_fieldEncoding) { if (bsEncoding == encoding.m_name) - return CFX_WideString::FromCodePage(csBValue, encoding.m_codePage); + return CFX_WideString::FromCodePage(csBValue.AsByteStringC(), + encoding.m_codePage); } CFX_ByteString csTemp = csBValue.Left(2); if (csTemp == "\xFF\xFE" || csTemp == "\xFE\xFF") return PDF_DecodeText(csBValue); - return CFX_WideString::FromLocal(csBValue); + return CFX_WideString::FromLocal(csBValue.AsByteStringC()); } } // namespace -- cgit v1.2.3