-
Notifications
You must be signed in to change notification settings - Fork 1.2k
CoreFoundation cleanup for Windows #1828
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
0ea450d
8e36a45
cfd1434
f72877d
39d47ff
a3d0f7a
137e558
c2a79a6
a497812
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,10 +57,12 @@ CF_EXPORT void _CFRuntimeSetCFMPresent(void *a); | |
CF_EXPORT const char *_CFProcessPath(void); | ||
CF_EXPORT const char **_CFGetProcessPath(void); | ||
CF_EXPORT const char **_CFGetProgname(void); | ||
|
||
#if !TARGET_OS_WIN32 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We like to keep these in the positive sense if possible There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, would you prefer:
Trying to exhaustively enumerate the other targets seems like a failing exercise since most OSes are Unixy :-(. But, if that really is preferable, I can attempt to do that. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hm, maybe it's ok. I'm not sure if we are super consistent about it anyway. |
||
CF_EXPORT void _CFGetUGIDs(uid_t *euid, gid_t *egid); | ||
CF_EXPORT uid_t _CFGetEUID(void); | ||
CF_EXPORT uid_t _CFGetEGID(void); | ||
|
||
#endif | ||
|
||
#if (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE || TARGET_OS_LINUX)) | ||
CF_EXPORT void _CFRunLoopSetCurrent(CFRunLoopRef rl); | ||
|
@@ -220,8 +222,10 @@ typedef CF_OPTIONS(CFOptionFlags, CFSearchPathDomainMask) { | |
kCFAllDomainsMask = 0x0ffff /* all domains: all of the above and more, future items */ | ||
}; | ||
|
||
#if TARGET_OS_MAC || TARGET_OS_EMBEDDED | ||
CF_EXPORT | ||
CFArrayRef CFCopySearchPathForDirectoriesInDomains(CFSearchPathDirectory directory, CFSearchPathDomainMask domainMask, Boolean expandTilde); | ||
#endif | ||
|
||
|
||
/* Obsolete keys */ | ||
|
@@ -609,7 +613,6 @@ CF_EXPORT CFPropertyListRef _CFBundleCreateFilteredLocalizedInfoPlist(CFBundleRe | |
|
||
CF_EXPORT CFStringRef _CFGetWindowsAppleAppDataDirectory(void); | ||
CF_EXPORT CFArrayRef _CFGetWindowsBinaryDirectories(void); | ||
CF_EXPORT CFStringRef _CFGetWindowsAppleSystemLibraryDirectory(void); | ||
|
||
// If your Windows application does not use a CFRunLoop on the main thread (perhaps because it is reserved for handling UI events via Windows API), then call this function to make distributed notifications arrive using a different run loop. | ||
CF_EXPORT void _CFNotificationCenterSetRunLoop(CFNotificationCenterRef nc, CFRunLoopRef rl); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1193,11 +1193,6 @@ void __CFInitialize(void) { | |
CFNumberGetTypeID(); // NB: This does other work | ||
|
||
__CFCharacterSetInitialize(); | ||
|
||
#if DEPLOYMENT_TARGET_WINDOWS | ||
__CFWindowsNamedPipeInitialize(); | ||
#endif | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Did we remove this completely? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nearly completely ... had two straggling references remaining which I just cleaned up :-). |
||
__CFDateInitialize(); | ||
|
||
#if DEPLOYMENT_RUNTIME_SWIFT | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -495,7 +495,7 @@ static CFTypeRef _CFErrorPOSIXCallBack(CFErrorRef err, CFStringRef key) CF_RETUR | |
if (!errStr) return NULL; | ||
if (CFEqual(key, kCFErrorDescriptionKey)) return errStr; // If all we wanted was the non-localized description, we're done | ||
|
||
#if DEPLOYMENT_TARGET_MACOSX || DEPLOYMENT_TARGET_EMBEDDED || DEPLOYMENT_TARGET_WINDOWS | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hm, why is this concept not portable to Windows? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Windows doesn't really have POSIX-y errors. We can translate errors using |
||
#if DEPLOYMENT_TARGET_MACOSX || DEPLOYMENT_TARGET_EMBEDDED | ||
// We need a kCFErrorLocalizedFailureReasonKey, so look up a possible localization for the error message | ||
// Look for the bundle in /System/Library/CoreServices/CoreTypes.bundle | ||
CFArrayRef paths = CFCopySearchPathForDirectoriesInDomains(kCFLibraryDirectory, kCFSystemDomainMask, false); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -679,14 +679,10 @@ CFTimeZoneRef CFTimeZoneCreateWithWindowsName(CFAllocatorRef allocator, CFString | |
return retval; | ||
} | ||
|
||
extern CFStringRef _CFGetWindowsAppleSystemLibraryDirectory(void); | ||
static void __InitTZStrings(void) { | ||
static CFLock_t __CFTZDirLock = CFLockInit; | ||
__CFLock(&__CFTZDirLock); | ||
if (!__tzZoneInfo) { | ||
CFStringRef winDir = _CFGetWindowsAppleSystemLibraryDirectory(); | ||
__tzZoneInfo = CFStringCreateWithFormat(NULL, NULL, CFSTR("%@\\etc\\zoneinfo"), winDir); | ||
} | ||
// TODO(compnerd) figure out how to initialize __tzZoneInfo | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we'll need to make sure this works before merging right? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So, the interesting thing is that there is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think our Windows version of CF used to bring its own, but using the system TZ data is almost certainly better, since it can change underneath us. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreed, that's why I was okay with this being addressed subsequently when we can start playing with Foundation on Windows :-). |
||
if (!__tzDir && __tzZoneInfo) { | ||
int length = CFStringGetLength(__tzZoneInfo) + sizeof("\\zone.tab") + 1; | ||
__tzDir = malloc(length); // If we don't use ascii, we'll need to malloc more space | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is defined by the Windows SDK or compiler when building shared libraries?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its a slight abuse of the normal behaviour for Windows.
_USRDLL
is pretty commonly defined (by Visual Studio's default build rules), but it technically is meant for ATL/MFC applications building a COM server for a DLL (InProc server).