summaryrefslogtreecommitdiff
path: root/core/fxcrt/fx_basic_wstring.cpp
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-04-21 11:17:22 -0700
committerCommit bot <commit-bot@chromium.org>2016-04-21 11:17:22 -0700
commit334319477703b5ba136373c4e3598e9a56e7f081 (patch)
tree7d9d885d00e90609811495d10dce09aa6e7c100b /core/fxcrt/fx_basic_wstring.cpp
parentacd0d59e3c09f04bffd178aecd3638d3e189faba (diff)
downloadpdfium-334319477703b5ba136373c4e3598e9a56e7f081.tar.xz
Assert that CFX_ strings are pointer-size.
The principle has been implicit in the implementation, but make it obvious for future generations. Review URL: https://codereview.chromium.org/1904143002
Diffstat (limited to 'core/fxcrt/fx_basic_wstring.cpp')
-rw-r--r--core/fxcrt/fx_basic_wstring.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/core/fxcrt/fx_basic_wstring.cpp b/core/fxcrt/fx_basic_wstring.cpp
index 069b9fa42d..f3b430c7bf 100644
--- a/core/fxcrt/fx_basic_wstring.cpp
+++ b/core/fxcrt/fx_basic_wstring.cpp
@@ -59,6 +59,9 @@ const FX_WCHAR* FX_wcsstr(const FX_WCHAR* haystack,
} // namespace
+static_assert(sizeof(CFX_WideString) <= sizeof(FX_WCHAR*),
+ "Strings must not require more space than pointers");
+
CFX_WideString::CFX_WideString(const FX_WCHAR* pStr, FX_STRSIZE nLen) {
if (nLen < 0)
nLen = pStr ? FXSYS_wcslen(pStr) : 0;