summaryrefslogtreecommitdiff
path: root/xfa/fde/css/cfde_csstextbuf.cpp
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2017-03-17 15:14:19 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-03-17 22:54:26 +0000
commit85f019a8e7d33cbba368a6c6b75fd091269e14a1 (patch)
tree8dcf6fcd98309a48ebbd9e46cc8c0d23a57c0965 /xfa/fde/css/cfde_csstextbuf.cpp
parent240fe6d79f234896a966ddce0b9a125776dc9171 (diff)
downloadpdfium-85f019a8e7d33cbba368a6c6b75fd091269e14a1.tar.xz
Add pdfium::clamp() as a placeholder for std::clamp().chromium/3046
Ue it to fix a typo as well. BUG=pdfium:634 Change-Id: I2d686242ffb841aedc2fae6a3cf7a00bea667404 Reviewed-on: https://pdfium-review.googlesource.com/3113 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'xfa/fde/css/cfde_csstextbuf.cpp')
-rw-r--r--xfa/fde/css/cfde_csstextbuf.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/xfa/fde/css/cfde_csstextbuf.cpp b/xfa/fde/css/cfde_csstextbuf.cpp
index 5df09f0936..6f74db2a78 100644
--- a/xfa/fde/css/cfde_csstextbuf.cpp
+++ b/xfa/fde/css/cfde_csstextbuf.cpp
@@ -6,7 +6,7 @@
#include "xfa/fde/css/cfde_csstextbuf.h"
-#include <algorithm>
+#include "third_party/base/stl_util.h"
CFDE_CSSTextBuf::CFDE_CSSTextBuf()
: m_bExtBuf(false),
@@ -80,7 +80,7 @@ bool CFDE_CSSTextBuf::ExpandBuf(int32_t iDesiredSize) {
void CFDE_CSSTextBuf::Subtract(int32_t iStart, int32_t iLength) {
ASSERT(iStart >= 0 && iLength >= 0);
- iLength = std::max(std::min(iLength, m_iDatLen - iStart), 0);
+ iLength = pdfium::clamp(iLength, 0, m_iDatLen - iStart);
FXSYS_memmove(m_pBuffer, m_pBuffer + iStart, iLength * sizeof(wchar_t));
m_iDatLen = iLength;
}