From 33b42e4ab56d56ff02cd08a47c5f590875d886bf Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Wed, 19 Jul 2017 13:19:12 -0700 Subject: Rename StringCs c_str() to unterminated_c_str(). Since there is no guarantee of termination if the StringC was extracted from a snippet of another string. Make it more obvious that things like strlen(str.unterminated_c_str()) might be a bad idea. Change-Id: I7832248ed89ebbddf5c0bcd402aac7d40ec2adc2 Reviewed-on: https://pdfium-review.googlesource.com/8170 Commit-Queue: Tom Sepez Reviewed-by: dsinclair Reviewed-by: Henrique Nakashima --- core/fxge/android/cfpf_skiafontmgr.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'core/fxge/android') diff --git a/core/fxge/android/cfpf_skiafontmgr.cpp b/core/fxge/android/cfpf_skiafontmgr.cpp index ec5c610150..23fcd5bbec 100644 --- a/core/fxge/android/cfpf_skiafontmgr.cpp +++ b/core/fxge/android/cfpf_skiafontmgr.cpp @@ -161,7 +161,7 @@ uint32_t FPF_SkiaGetCharset(uint8_t uCharset) { uint32_t FPF_SKIANormalizeFontName(const CFX_ByteStringC& bsfamily) { uint32_t dwHash = 0; int32_t iLength = bsfamily.GetLength(); - const char* pBuffer = bsfamily.c_str(); + const char* pBuffer = bsfamily.unterminated_c_str(); for (int32_t i = 0; i < iLength; i++) { char ch = pBuffer[i]; if (ch == ' ' || ch == '-' || ch == ',') @@ -395,7 +395,7 @@ FXFT_Face CFPF_SkiaFontMgr::GetFontFace(const CFX_ByteStringC& bsFile, return nullptr; FXFT_Open_Args args; args.flags = FT_OPEN_PATHNAME; - args.pathname = const_cast(bsFile.c_str()); + args.pathname = const_cast(bsFile.unterminated_c_str()); FXFT_Face face; if (FXFT_Open_Face(m_FTLibrary, &args, iFaceIndex, &face)) return nullptr; -- cgit v1.2.3