From 85f019a8e7d33cbba368a6c6b75fd091269e14a1 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Fri, 17 Mar 2017 15:14:19 -0700 Subject: Add pdfium::clamp() as a placeholder for std::clamp(). 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 Reviewed-by: Tom Sepez --- xfa/fde/css/cfde_csstextbuf.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'xfa/fde') 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 +#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; } -- cgit v1.2.3