From 1835a6fb98286817cdf656f4d1e223bd85ee378f Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Fri, 7 Apr 2017 11:42:38 -0700 Subject: Tweak CFDF_Font::AppendChar() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pass in/out argument as a pointer. Avoid pointless malloc just to copy in multibyte case. Then we can avoid special-casing the single-byte case. Change-Id: I3dd2d57e08ef6ad7b78ea38398b228fa41a9b3e6 Reviewed-on: https://pdfium-review.googlesource.com/3950 Reviewed-by: Nicolás Peña Commit-Queue: Tom Sepez --- core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'core/fpdfapi/edit') diff --git a/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp b/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp index 14e4ed32c5..e431b9bf57 100644 --- a/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp +++ b/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp @@ -279,9 +279,8 @@ void CPDF_PageContentGenerator::ProcessText(CFX_ByteTextBuf* buf, << " Tf "; CFX_ByteString text; for (uint32_t charcode : pTextObj->m_CharCodes) { - if (charcode == CPDF_Font::kInvalidCharCode) - continue; - pFont->AppendChar(text, charcode); + if (charcode != CPDF_Font::kInvalidCharCode) + pFont->AppendChar(&text, charcode); } *buf << PDF_EncodeString(text, true) << " Tj ET\n"; } -- cgit v1.2.3