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/font/cpdf_font.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'core/fpdfapi/font/cpdf_font.cpp') diff --git a/core/fpdfapi/font/cpdf_font.cpp b/core/fpdfapi/font/cpdf_font.cpp index 60eb1b361d..a6a661b328 100644 --- a/core/fpdfapi/font/cpdf_font.cpp +++ b/core/fpdfapi/font/cpdf_font.cpp @@ -136,14 +136,10 @@ int CPDF_Font::AppendChar(char* buf, uint32_t charcode) const { return 1; } -void CPDF_Font::AppendChar(CFX_ByteString& str, uint32_t charcode) const { +void CPDF_Font::AppendChar(CFX_ByteString* str, uint32_t charcode) const { char buf[4]; int len = AppendChar(buf, charcode); - if (len == 1) { - str += buf[0]; - } else { - str += CFX_ByteString(buf, len); - } + *str += CFX_ByteStringC(buf, len); } CFX_WideString CPDF_Font::UnicodeFromCharCode(uint32_t charcode) const { -- cgit v1.2.3