Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1407)

Unified Diff: third_party/base/stl_util.h

Issue 1631863003: Merge to XFA: Remove CFX_SegmentedArray use from master. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/src/fxcrt/fx_basic_array.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/base/stl_util.h
diff --git a/third_party/base/stl_util.h b/third_party/base/stl_util.h
index 32656038c145c2ba33a2c91edbd27afac4d8df09..7f1d38bf4026dff786efc7c04644d120e8df4307 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_
« no previous file with comments | « core/src/fxcrt/fx_basic_array.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698