summaryrefslogtreecommitdiff
path: root/third_party/base/stl_util.h
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2016-01-25 15:55:59 -0800
committerTom Sepez <tsepez@chromium.org>2016-01-25 15:55:59 -0800
commit52bb44383a705b600e0d028bff5ade17856f5a60 (patch)
tree3d8446e16ff1087c729660746d2af92ce828c7d2 /third_party/base/stl_util.h
parente24ea22700c9fc534d40cc510d59c453aa9d0ddb (diff)
downloadpdfium-52bb44383a705b600e0d028bff5ade17856f5a60.tar.xz
Merge to XFA: Remove CFX_SegmentedArray use from master.
Unfortunately, it is still used on the xfa/ side, so exclude it only for non-xfa builds. Original Review URL: https://codereview.chromium.org/1618273004 . (cherry picked from commit c64e4007ee4561ec2ed3ce986191caf9b024ef55) TBR=ochang@chromium.org TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1631863003 .
Diffstat (limited to 'third_party/base/stl_util.h')
-rw-r--r--third_party/base/stl_util.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/third_party/base/stl_util.h b/third_party/base/stl_util.h
index 32656038c1..7f1d38bf40 100644
--- a/third_party/base/stl_util.h
+++ b/third_party/base/stl_util.h
@@ -5,6 +5,8 @@
#ifndef PDFIUM_THIRD_PARTY_BASE_STL_UTIL_H_
#define PDFIUM_THIRD_PARTY_BASE_STL_UTIL_H_
+#include "third_party/base/numerics/safe_conversions.h"
+
namespace pdfium {
// Test to see if a set, map, hash_set or hash_map contains a particular key.
@@ -22,6 +24,13 @@ bool ContainsValue(const Collection& collection, const Value& value) {
collection.end();
}
+// Convenience routine for "int-fected" code, so that the stl collection
+// size_t size() method return values will be checked.
+template <typename ResultType, typename Collection>
+ResultType CollectionSize(const Collection& collection) {
+ return pdfium::base::checked_cast<ResultType, size_t>(collection.size());
+}
+
} // namespace pdfium
#endif // PDFIUM_THIRD_PARTY_BASE_STL_UTIL_H_