Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(731)

Unified Diff: core/fxcrt/include/fx_string.h

Issue 1877553002: Avoid copying in TrimRight() and TrimLeft() if possible. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: More accurate comment in fx_string.h Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/fxcrt/fx_basic_wstring_unittest.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fxcrt/include/fx_string.h
diff --git a/core/fxcrt/include/fx_string.h b/core/fxcrt/include/fx_string.h
index 5e3cb45fba3b0c16fef2f12517b48574a8a1ddb3..38328dabdeffba31e6f350953ce5ba2b92d61612 100644
--- a/core/fxcrt/include/fx_string.h
+++ b/core/fxcrt/include/fx_string.h
@@ -167,14 +167,14 @@ 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;
@@ -187,7 +187,7 @@ class CFX_ByteString {
}
// 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());
}
@@ -503,15 +503,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());
}
« no previous file with comments | « core/fxcrt/fx_basic_wstring_unittest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698