commit bfcb80eb8a3ef5117b9ad57246d2ec2cb23eb135 parent b470924f957e0de22d36aa68b14f0d84eb22bb3d Author: Ryan VanderMeulen <rvandermeulen@mozilla.com> Date: Thu, 2 Oct 2025 20:14:31 +0000 Bug 1992247 - Use NSLocale.countryCode instead of NSLocaleCountryCode. r=mstange Differential Revision: https://phabricator.services.mozilla.com/D267293 Diffstat:
| M | xpcom/base/MacHelpers.mm | | | 8 | +++----- |
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/xpcom/base/MacHelpers.mm b/xpcom/base/MacHelpers.mm @@ -16,15 +16,13 @@ namespace mozilla { nsresult GetSelectedCityInfo(nsAString& aCountryCode) { NS_OBJC_BEGIN_TRY_BLOCK_RETURN; - // Can be replaced with [[NSLocale currentLocale] countryCode] once we build - // with the 10.12 SDK. - id countryCode = [[NSLocale currentLocale] objectForKey:NSLocaleCountryCode]; + NSString* countryCode = NSLocale.currentLocale.countryCode; - if (![countryCode isKindOfClass:[NSString class]]) { + if (!countryCode) { return NS_ERROR_FAILURE; } - mozilla::CopyNSStringToXPCOMString((NSString*)countryCode, aCountryCode); + mozilla::CopyNSStringToXPCOMString(countryCode, aCountryCode); return NS_OK;