diff options
author | Tom Sepez <tsepez@chromium.org> | 2018-06-20 16:10:13 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-06-20 16:10:13 +0000 |
commit | b6b01cb2cbaf6b38736f4dfebb9b6cdc243960f9 (patch) | |
tree | 3219404f5dbafe19205ce85d19acaf3b1178f977 /xfa | |
parent | b3345feca2741cef2073d18da414237589528dd0 (diff) | |
download | pdfium-b6b01cb2cbaf6b38736f4dfebb9b6cdc243960f9.tar.xz |
Re-work some more c_str() usage.
Many of these are converting ByteString => c_str => ByteStringView, since
the ByteStringView ctor is implicit. This is unfortunate, since that
involves a strlen() which the ByteString already knows if we use
AsStringView() instead.
This changed one test result where we can now return the string
"\0" instead of "" -- since strlen no longer eats the NUL. This
seems consistent, say, with String.fromCharCode().
Change-Id: I17f68d1a1f4b352960208f9148e68ab4c4d78bd2
Reviewed-on: https://pdfium-review.googlesource.com/35590
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'xfa')
-rw-r--r-- | xfa/fde/cfde_texteditengine.cpp | 2 | ||||
-rw-r--r-- | xfa/fgas/font/cfgas_fontmgr.cpp | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/xfa/fde/cfde_texteditengine.cpp b/xfa/fde/cfde_texteditengine.cpp index 71b413c35f..ce9d0a576c 100644 --- a/xfa/fde/cfde_texteditengine.cpp +++ b/xfa/fde/cfde_texteditengine.cpp @@ -238,7 +238,7 @@ size_t CFDE_TextEditEngine::CountCharsExceedingSize(const WideString& text, text_out->SetStyles(style); size_t length = text.GetLength(); - WideStringView temp(text.c_str(), length); + WideStringView temp = text.AsStringView(); float vertical_height = line_spacing_ * visible_line_count_; size_t chars_exceeding_size = 0; diff --git a/xfa/fgas/font/cfgas_fontmgr.cpp b/xfa/fgas/font/cfgas_fontmgr.cpp index abd5aa716a..59d4563c29 100644 --- a/xfa/fgas/font/cfgas_fontmgr.cpp +++ b/xfa/fgas/font/cfgas_fontmgr.cpp @@ -492,7 +492,7 @@ bool CFGAS_FontMgr::EnumFontsFromFontMapper() { continue; WideString wsFaceName = - WideString::FromLocal(pFontMapper->GetFaceName(i).c_str()); + WideString::FromLocal(pFontMapper->GetFaceName(i).AsStringView()); RegisterFaces(pFontStream, &wsFaceName); } |