summaryrefslogtreecommitdiff
path: root/core/fxcrt/include/fx_string.h
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-04-11 10:56:00 -0700
committerCommit bot <commit-bot@chromium.org>2016-04-11 10:56:00 -0700
commit184b82553000a41fd0c90be56fa2f1c1503e2e9e (patch)
tree568f3877f8f51cc80e8aacb355ba07674e673e9c /core/fxcrt/include/fx_string.h
parentf3209c1fe0fdea79bf2f4e2b6f77ea4ef5db1ad2 (diff)
downloadpdfium-184b82553000a41fd0c90be56fa2f1c1503e2e9e.tar.xz
Avoid copying in TrimRight() and TrimLeft() if possible.
Make Byte and Wide code identical while at it. Review URL: https://codereview.chromium.org/1877553002
Diffstat (limited to 'core/fxcrt/include/fx_string.h')
-rw-r--r--core/fxcrt/include/fx_string.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/core/fxcrt/include/fx_string.h b/core/fxcrt/include/fx_string.h
index 0e3160a9d8..ef0dfee6fb 100644
--- a/core/fxcrt/include/fx_string.h
+++ b/core/fxcrt/include/fx_string.h
@@ -167,21 +167,21 @@ class CFX_ByteString {
static CFX_ByteString FromUnicode(const CFX_WideString& str);
// Explicit conversion to C-style string.
- // Note: |this| must outlive the use of the result.
+ // Note: Any subsequent modification of |this| will invalidate the result.
const FX_CHAR* c_str() const { return m_pData ? m_pData->m_String : ""; }
// Implicit conversion to C-style string -- deprecated.
operator const FX_CHAR*() const { return m_pData ? m_pData->m_String : ""; }
// Explicit conversion to uint8_t*.
- // Note: |this| must outlive the use of the result.
+ // Note: Any subsequent modification of |this| will invalidate the result.
const uint8_t* raw_str() const {
return m_pData ? reinterpret_cast<const uint8_t*>(m_pData->m_String)
: nullptr;
}
// Explicit conversion to CFX_ByteStringC.
- // Note: |this| must outlive the use of the result.
+ // Note: Any subsequent modification of |this| will invalidate the result.
CFX_ByteStringC AsStringC() const {
return CFX_ByteStringC(raw_str(), GetLength());
}
@@ -497,15 +497,15 @@ class CFX_WideString {
static FX_STRSIZE WStringLength(const unsigned short* str);
// Explicit conversion to C-style wide string.
- // Note: |this| must outlive the use of the result.
+ // Note: Any subsequent modification of |this| will invalidate the result.
const FX_WCHAR* c_str() const { return m_pData ? m_pData->m_String : L""; }
// Implicit conversion to C-style wide string -- deprecated.
- // Note: |this| must outlive the use of the result.
+ // Note: Any subsequent modification of |this| will invalidate the result.
operator const FX_WCHAR*() const { return m_pData ? m_pData->m_String : L""; }
// Explicit conversion to CFX_WideStringC.
- // Note: |this| must outlive the use of the result.
+ // Note: Any subsequent modification of |this| will invalidate the result.
CFX_WideStringC AsStringC() const {
return CFX_WideStringC(c_str(), GetLength());
}