From 184b82553000a41fd0c90be56fa2f1c1503e2e9e Mon Sep 17 00:00:00 2001 From: tsepez Date: Mon, 11 Apr 2016 10:56:00 -0700 Subject: Avoid copying in TrimRight() and TrimLeft() if possible. Make Byte and Wide code identical while at it. Review URL: https://codereview.chromium.org/1877553002 --- core/fxcrt/include/fx_string.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'core/fxcrt/include') 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(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()); } -- cgit v1.2.3