diff options
author | Ryan Harrison <rharrison@chromium.org> | 2017-09-13 11:16:32 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-09-13 15:42:13 +0000 |
commit | 06c6855258bf25246c46a1f628b8a8a8185029a7 (patch) | |
tree | 7db9bd2cae8672a06834105542cef5c70bc9db08 /core/fxcrt/cfx_widetextbuf.h | |
parent | f2ca50ffa2d26a6c023add24e92adbe6b28bfcc9 (diff) | |
download | pdfium-06c6855258bf25246c46a1f628b8a8a8185029a7.tar.xz |
Rewrite IsHyphen using string operations
The existing code did end of range checks by making sure that the
value was never less then 0. This isn't correct when using an unsigned
type, since 0 - 1 will wrap around to the max possible value, and
thus still be less then 0. Additionally the existing code was hard to
follow due to the complexity of some of the low level operations being
performed.
It has been rewritten using higher level string operations to make it
clearer and correct.
BUG=chromium:763256
Change-Id: Ib8bf5ca0e29e73724c4a1c4781362e8a8fc30149
Reviewed-on: https://pdfium-review.googlesource.com/13690
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'core/fxcrt/cfx_widetextbuf.h')
-rw-r--r-- | core/fxcrt/cfx_widetextbuf.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/core/fxcrt/cfx_widetextbuf.h b/core/fxcrt/cfx_widetextbuf.h index 0c9b6ff99d..389f2e52a3 100644 --- a/core/fxcrt/cfx_widetextbuf.h +++ b/core/fxcrt/cfx_widetextbuf.h @@ -14,7 +14,7 @@ class CFX_WideTextBuf : public CFX_BinaryBuf { public: void AppendChar(wchar_t wch); - FX_STRSIZE GetLength() const { return m_DataSize / sizeof(wchar_t); } + FX_STRSIZE GetLength() const override; wchar_t* GetBuffer() const { return reinterpret_cast<wchar_t*>(m_pBuffer.get()); } |