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/fxcrt/fxcrt_windows.cpp | |
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/fxcrt/fxcrt_windows.cpp')
-rw-r--r-- | core/fxcrt/fxcrt_windows.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/core/fxcrt/fxcrt_windows.cpp b/core/fxcrt/fxcrt_windows.cpp index 6230c74eb7..1a2a36735e 100644 --- a/core/fxcrt/fxcrt_windows.cpp +++ b/core/fxcrt/fxcrt_windows.cpp @@ -57,8 +57,8 @@ bool CFXCRT_FileAccess_Win64::Open(const CFX_ByteStringC& fileName, uint32_t dwAccess, dwShare, dwCreation; FXCRT_Windows_GetFileMode(dwMode, dwAccess, dwShare, dwCreation); - m_hFile = ::CreateFileA(fileName.c_str(), dwAccess, dwShare, nullptr, - dwCreation, FILE_ATTRIBUTE_NORMAL, nullptr); + m_hFile = ::CreateFileA(fileName.unterminated_c_str(), dwAccess, dwShare, + nullptr, dwCreation, FILE_ATTRIBUTE_NORMAL, nullptr); if (m_hFile == INVALID_HANDLE_VALUE) m_hFile = nullptr; @@ -72,8 +72,9 @@ bool CFXCRT_FileAccess_Win64::Open(const CFX_WideStringC& fileName, uint32_t dwAccess, dwShare, dwCreation; FXCRT_Windows_GetFileMode(dwMode, dwAccess, dwShare, dwCreation); - m_hFile = ::CreateFileW((LPCWSTR)fileName.c_str(), dwAccess, dwShare, nullptr, - dwCreation, FILE_ATTRIBUTE_NORMAL, nullptr); + m_hFile = + ::CreateFileW((LPCWSTR)fileName.unterminated_c_str(), dwAccess, dwShare, + nullptr, dwCreation, FILE_ATTRIBUTE_NORMAL, nullptr); if (m_hFile == INVALID_HANDLE_VALUE) m_hFile = nullptr; |