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

Unified Diff: mac/foundation_util.mm

Issue 2050803003: Update to Chromium //base at Chromium commit e3a753f17bac62738b0dbf0b36510f767b081e4b. (Closed) Base URL: https://github.com/domokit/base.git@master
Patch Set: Created 4 years, 6 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 | « mac/foundation_util.h ('k') | mac/foundation_util_unittest.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mac/foundation_util.mm
diff --git a/mac/foundation_util.mm b/mac/foundation_util.mm
index 27d6e7c4653b50c95037652928361aad9b0a0ff3..bd5d51452dcf6a1d7ec63b9fd60a39a3a2931282 100644
--- a/mac/foundation_util.mm
+++ b/mac/foundation_util.mm
@@ -11,6 +11,7 @@
#include "base/logging.h"
#include "base/mac/bundle_locations.h"
#include "base/mac/mac_logging.h"
+#include "base/numerics/safe_conversions.h"
#include "base/strings/sys_string_conversions.h"
#if !defined(OS_IOS)
@@ -430,6 +431,19 @@ FilePath NSStringToFilePath(NSString* str) {
return FilePath([str fileSystemRepresentation]);
}
+bool CFRangeToNSRange(CFRange range, NSRange* range_out) {
+ if (base::IsValueInRangeForNumericType<decltype(range_out->location)>(
+ range.location) &&
+ base::IsValueInRangeForNumericType<decltype(range_out->length)>(
+ range.length) &&
+ base::IsValueInRangeForNumericType<decltype(range_out->location)>(
+ range.location + range.length)) {
+ *range_out = NSMakeRange(range.location, range.length);
+ return true;
+ }
+ return false;
+}
+
} // namespace mac
} // namespace base
« no previous file with comments | « mac/foundation_util.h ('k') | mac/foundation_util_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698