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/fxfa/parser/cxfa_widetextread.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'xfa/fxfa/parser/cxfa_widetextread.cpp') diff --git a/xfa/fxfa/parser/cxfa_widetextread.cpp b/xfa/fxfa/parser/cxfa_widetextread.cpp index bba7cbdaa1..73da5c670b 100644 --- a/xfa/fxfa/parser/cxfa_widetextread.cpp +++ b/xfa/fxfa/parser/cxfa_widetextread.cpp @@ -9,6 +9,7 @@ #include #include "core/fxcrt/fx_ext.h" +#include "third_party/base/stl_util.h" #include "xfa/fgas/crt/fgas_codepage.h" CXFA_WideTextRead::CXFA_WideTextRead(const CFX_WideString& wsBuffer) @@ -36,7 +37,7 @@ int32_t CXFA_WideTextRead::Seek(FX_STREAMSEEK eSeek, int32_t iOffset) { m_iPosition = m_wsBuffer.GetLength() + iOffset; break; } - m_iPosition = std::min(std::max(0, m_iPosition), m_wsBuffer.GetLength()); + m_iPosition = pdfium::clamp(0, m_iPosition, m_wsBuffer.GetLength()); return GetPosition(); } -- cgit v1.2.3