Files
palemoon27/xpcom/base/MacHelpers.mm
T
roytam1 618cb96229 import changes from `dev' branch of rmottola/Arctic-Fox:
- Bug 865222 - Add MOZ_GUARD_OBJECT_NOTIFIER_PARAM to JSAutoCompartmentand JSAutoNullableCompartment; r=efaust (97d89fcd7)
- Bug 1131325 - Move system country code from nsIGfxInfo2 to a more appropriate location. r=aklotz,smichaud (afb055f6b)
- Bug 1192456 - Use perfect forwarding for DispatchWrapper rather than explicit move and copy constructors. r=terrence (bd30eb21e)
- Bug 1155726 - OdinMonkey: add new cache failure code for when storage initialization fails (r=janv) (60fb4de2a)
- Bug 1155292 - Add a check for properties found on non-native prototypes during Ion caching, r=jandem. (6864981f7)
- pointer style (28c86a2d7)
2021-12-09 09:23:47 +08:00

34 lines
932 B
Plaintext

/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsString.h"
#include "MacHelpers.h"
#import <Foundation/Foundation.h>
namespace mozilla {
nsresult
GetSelectedCityInfo(nsAString& aCountryCode)
{
NSDictionary* selected_city =
[[NSUserDefaults standardUserDefaults]
objectForKey:@"com.apple.preferences.timezone.selected_city"];
NSString *countryCode = (NSString *)
[selected_city objectForKey:@"CountryCode"];
const char *countryCodeUTF8 = [countryCode UTF8String];
if (!countryCodeUTF8) {
return NS_ERROR_FAILURE;
}
AppendUTF8toUTF16(countryCodeUTF8, aCountryCode);
return NS_OK;
}
} // namespace Mozilla