diff options
Diffstat (limited to 'fpdfsdk')
-rw-r--r-- | fpdfsdk/src/fsdk_mgr.cpp | 7 | ||||
-rw-r--r-- | fpdfsdk/src/javascript/JS_Runtime.cpp | 5 | ||||
-rw-r--r-- | fpdfsdk/src/javascript/util.cpp | 12 |
3 files changed, 10 insertions, 14 deletions
diff --git a/fpdfsdk/src/fsdk_mgr.cpp b/fpdfsdk/src/fsdk_mgr.cpp index e01fe89610..03edd83891 100644 --- a/fpdfsdk/src/fsdk_mgr.cpp +++ b/fpdfsdk/src/fsdk_mgr.cpp @@ -13,6 +13,7 @@ #include "fpdfsdk/include/javascript/IJavaScript.h" #include "public/fpdf_ext.h" #include "third_party/base/nonstd_unique_ptr.h" +#include "third_party/base/stl_util.h" #if _FX_OS_ == _FX_ANDROID_ #include "time.h" @@ -689,9 +690,7 @@ CPDFSDK_Annot* CPDFSDK_PageView::GetFXWidgetAtPoint(FX_FLOAT pageX, void CPDFSDK_PageView::KillFocusAnnotIfNeeded() { // if there is a focused annot on the page, we should kill the focus first. if (CPDFSDK_Annot* focusedAnnot = m_pSDKDoc->GetFocusAnnot()) { - auto it = - std::find(m_fxAnnotArray.begin(), m_fxAnnotArray.end(), focusedAnnot); - if (it != m_fxAnnotArray.end()) + if (pdfium::ContainsValue(m_fxAnnotArray, focusedAnnot)) KillFocusAnnot(); } } @@ -911,7 +910,7 @@ bool CPDFSDK_PageView::IsValidAnnot(const CPDF_Annot* p) const { return false; const auto& annots = m_pAnnotList->All(); - return std::find(annots.begin(), annots.end(), p) != annots.end(); + return pdfium::ContainsValue(annots, p); } CPDFSDK_Annot* CPDFSDK_PageView::GetFocusAnnot() { diff --git a/fpdfsdk/src/javascript/JS_Runtime.cpp b/fpdfsdk/src/javascript/JS_Runtime.cpp index f52e23a094..b08823f6ed 100644 --- a/fpdfsdk/src/javascript/JS_Runtime.cpp +++ b/fpdfsdk/src/javascript/JS_Runtime.cpp @@ -26,6 +26,7 @@ #include "global.h" #include "report.h" #include "util.h" +#include "third_party/base/stl_util.h" // static void IJS_Runtime::Initialize(unsigned int slot, void* isolate) { @@ -206,11 +207,11 @@ v8::Local<v8::Context> CJS_Runtime::NewJSContext() { } void CJS_Runtime::AddObserver(Observer* observer) { - ASSERT(m_observers.find(observer) == m_observers.end()); + ASSERT(!pdfium::ContainsKey(m_observers, observer)); m_observers.insert(observer); } void CJS_Runtime::RemoveObserver(Observer* observer) { - ASSERT(m_observers.find(observer) != m_observers.end()); + ASSERT(pdfium::ContainsKey(m_observers, observer)); m_observers.erase(observer); } diff --git a/fpdfsdk/src/javascript/util.cpp b/fpdfsdk/src/javascript/util.cpp index cb9c9b2231..a14e81c203 100644 --- a/fpdfsdk/src/javascript/util.cpp +++ b/fpdfsdk/src/javascript/util.cpp @@ -468,17 +468,13 @@ void util::printx(const std::string& cFormat, case '\\': break; case '>': { - for (std::string::iterator it = cSource.begin(); it != cSource.end(); - it++) { - *it = toupper(*it); - } + for (char& c : cSource) + c = toupper(c); break; } case '<': { - for (std::string::iterator it = cSource.begin(); it != cSource.end(); - it++) { - *it = tolower(*it); - } + for (char& c : cSource) + c = tolower(c); break; } case '=': |