diff options
author | Tom Sepez <tsepez@chromium.org> | 2017-07-19 13:19:12 -0700 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-07-19 20:59:29 +0000 |
commit | 33b42e4ab56d56ff02cd08a47c5f590875d886bf (patch) | |
tree | d168b57aa48373a3213f918471fcd1c8224d2d5d /core/fxge | |
parent | d4c401194137f3f7f466f6daaa7fe3ffb4b6cd53 (diff) | |
download | pdfium-33b42e4ab56d56ff02cd08a47c5f590875d886bf.tar.xz |
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 <tsepez@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Diffstat (limited to 'core/fxge')
-rw-r--r-- | core/fxge/android/cfpf_skiafontmgr.cpp | 4 | ||||
-rw-r--r-- | core/fxge/win32/cpsoutput.cpp | 2 |
2 files changed, 3 insertions, 3 deletions
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<FT_String*>(bsFile.c_str()); + args.pathname = const_cast<FT_String*>(bsFile.unterminated_c_str()); FXFT_Face face; if (FXFT_Open_Face(m_FTLibrary, &args, iFaceIndex, &face)) return nullptr; diff --git a/core/fxge/win32/cpsoutput.cpp b/core/fxge/win32/cpsoutput.cpp index 7139340a6e..1af6dbdced 100644 --- a/core/fxge/win32/cpsoutput.cpp +++ b/core/fxge/win32/cpsoutput.cpp @@ -32,5 +32,5 @@ bool CPSOutput::WriteBlock(const void* str, size_t len) { } bool CPSOutput::WriteString(const CFX_ByteStringC& str) { - return WriteBlock(str.c_str(), str.GetLength()); + return WriteBlock(str.unterminated_c_str(), str.GetLength()); } |