From c2869fe43b07b442f1a75eeb9ccfbdc52cc0f62e Mon Sep 17 00:00:00 2001 From: Apple Date: Tue, 8 Nov 2011 00:32:20 +0000 Subject: [PATCH] CF-635.15.tar.gz --- CFArray.c | 6 +- CFBundle.c | 2 - CFInternal.h | 4 -- CFPlatform.c | 2 - CFPriv.h | 3 + CFURL.c | 15 +++++ CFVersion.c | 4 +- CFWindowsUtilities.c | 138 +++++++++++++++++++++++++++++++++++++++++++ Info.plist | 2 +- MakefileLinux | 5 +- MakefileVersion | 2 +- 11 files changed, 164 insertions(+), 19 deletions(-) create mode 100644 CFWindowsUtilities.c diff --git a/CFArray.c b/CFArray.c index d5b0704..587dcff 100644 --- a/CFArray.c +++ b/CFArray.c @@ -30,7 +30,6 @@ #include #include "CFInternal.h" #include -#include const CFArrayCallBacks kCFTypeArrayCallBacks = {0, __CFTypeCollectionRetain, __CFTypeCollectionRelease, CFCopyDescription, CFEqual}; static const CFArrayCallBacks __kCFNullArrayCallBacks = {0, NULL, NULL, NULL, NULL}; @@ -1084,10 +1083,11 @@ CFIndex CFArrayBSearchValues(CFArrayRef array, CFRange range, const void *value, } SInt32 lg = flsl(range.length) - 1; // lg2(range.length) item = CFArrayGetValueAtIndex(array, range.location + -1 + (1 << lg)); - CFIndex idx = range.location + ((CFComparisonResult)(INVOKE_CALLBACK3(comparator, item, value, context)) < 0) ? range.length - (1 << lg) : -1; + // idx will be the current probe index into the range + CFIndex idx = (comparator(item, value, context) < 0) ? range.length - (1 << lg) : -1; while (lg--) { item = CFArrayGetValueAtIndex(array, range.location + idx + (1 << lg)); - if ((CFComparisonResult)(INVOKE_CALLBACK3(comparator, item, value, context)) < 0) { + if (comparator(item, value, context) < 0) { idx += (1 << lg); } } diff --git a/CFBundle.c b/CFBundle.c index 2bfea0f..a846617 100644 --- a/CFBundle.c +++ b/CFBundle.c @@ -37,7 +37,6 @@ #include "CFInternal.h" #include #include "CFBundle_BinaryTypes.h" -#include #include #include #include @@ -4789,7 +4788,6 @@ __private_extern__ void *_CFBundleDLLGetSymbolByName(CFBundleRef bundle, CFStrin /* Workarounds to be applied in the presence of certain bundles can go here. This is called on every bundle creation. */ -CF_EXPORT void _CFStringSetCompatibility(CFOptionFlags); static void _CFBundleCheckWorkarounds(CFBundleRef bundle) { } diff --git a/CFInternal.h b/CFInternal.h index c573ea8..e79a854 100644 --- a/CFInternal.h +++ b/CFInternal.h @@ -302,10 +302,6 @@ extern const char *__CFgetenv(const char *n); #endif -CF_EXPORT CFTypeRef _CFTryRetain(CFTypeRef cf); -CF_EXPORT Boolean _CFIsDeallocating(CFTypeRef cf); - - CF_EXPORT void * __CFConstantStringClassReferencePtr; #ifdef __CONSTANT_CFSTRINGS__ diff --git a/CFPlatform.c b/CFPlatform.c index 9785888..2024d39 100644 --- a/CFPlatform.c +++ b/CFPlatform.c @@ -591,8 +591,6 @@ static void __CFTSDFinalize(void *arg); #if DEPLOYMENT_TARGET_WINDOWS -#include "CFVersionCheck.h" - static DWORD __CFTSDIndexKey = 0xFFFFFFFF; // Called from CFRuntime's startup code, on Windows only diff --git a/CFPriv.h b/CFPriv.h index d1694fe..edd6f23 100644 --- a/CFPriv.h +++ b/CFPriv.h @@ -419,6 +419,9 @@ CF_INLINE bool CFCharacterSetInlineBufferIsLongCharacterMember(CFCharacterSetInl CF_EXPORT CFMutableStringRef _CFCreateApplicationRepositoryPath(CFAllocatorRef alloc, int nFolder); #endif +CF_EXPORT CFTypeRef _CFTryRetain(CFTypeRef cf); +CF_EXPORT Boolean _CFIsDeallocating(CFTypeRef cf); + /* CFLocaleGetLanguageRegionEncodingForLocaleIdentifier gets the appropriate language and region codes, and the default legacy script code and encoding, for the specified locale (or language) string. diff --git a/CFURL.c b/CFURL.c index 786c5ba..9be2854 100644 --- a/CFURL.c +++ b/CFURL.c @@ -1054,8 +1054,15 @@ static CFStringRef __CFURLCopyFormattingDescription(CFTypeRef cf, CFDictionary CFURLRef url = (CFURLRef)cf; __CFGenericValidateType(cf, CFURLGetTypeID()); if (! url->_base) { +#if DEPLOYMENT_TARGET_MACOSX + { + CFRetain(url->_string); + return url->_string; + } +#else CFRetain(url->_string); return url->_string; +#endif } else { // Do not dereference url->_base; it may be an ObjC object return CFStringCreateWithFormat(CFGetAllocator(url), NULL, CFSTR("%@ -- %@"), url->_string, url->_base); @@ -1655,6 +1662,14 @@ static void _CFURLInit(struct __CFURL *url, CFStringRef URLString, UInt32 fsType if ( url->_base ) numURLsWithBaseURL ++; #endif + { + if (URL_PATH_TYPE(url) != FULL_URL_REPRESENTATION) { + _convertToURLRepresentation((struct __CFURL *)url); + } + if (!(url->_flags & IS_PARSED)) { + _parseComponentsOfURL(url); + } + } } #if DEPLOYMENT_TARGET_MACOSX || DEPLOYMENT_TARGET_EMBEDDED || DEPLOYMENT_TARGET_LINUX diff --git a/CFVersion.c b/CFVersion.c index 59cfa1c..1fcfb29 100644 --- a/CFVersion.c +++ b/CFVersion.c @@ -25,5 +25,5 @@ Copyright 2009-2011, Apple Inc. All rights reserved. Responsibility: CFLite Team */ -const unsigned char kCFCoreFoundationVersionString[] = "@(#)PROGRAM:CoreFoundation PROJECT:CoreFoundation-635 SYSTEM:Darwin DEVELOPER:unknown BUILT:" __DATE__ " " __TIME__ "\n"; -double kCFCoreFoundationVersionNumber = (double)635; +const unsigned char kCFCoreFoundationVersionString[] = "@(#)PROGRAM:CoreFoundation PROJECT:CoreFoundation-635.15 SYSTEM:Darwin DEVELOPER:unknown BUILT:" __DATE__ " " __TIME__ "\n"; +double kCFCoreFoundationVersionNumber = (double)635.15; diff --git a/CFWindowsUtilities.c b/CFWindowsUtilities.c new file mode 100644 index 0000000..95e545e --- /dev/null +++ b/CFWindowsUtilities.c @@ -0,0 +1,138 @@ +/* + * Copyright (c) 2011 Apple Inc. All rights reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +/* + CFWindowsUtilities.c + Copyright (c) 2008-2011, Apple Inc. All rights reserved. + Responsibility: Tony Parker +*/ + +#if DEPLOYMENT_TARGET_WINDOWS + +#include +#include +#include "CFInternal.h" +#include "CFPriv.h" + +#include + +#include + +CF_EXPORT bool OSAtomicCompareAndSwapPtr(void *oldp, void *newp, void *volatile *dst) +{ + return oldp == InterlockedCompareExchangePointer(dst, newp, oldp); +} + +CF_EXPORT bool OSAtomicCompareAndSwapLong(long oldl, long newl, long volatile *dst) +{ + return oldl == InterlockedCompareExchange(dst, newl, oldl); +} + +CF_EXPORT bool OSAtomicCompareAndSwapPtrBarrier(void *oldp, void *newp, void *volatile *dst) +{ + return oldp == InterlockedCompareExchangePointer(dst, newp, oldp); +} + +CF_EXPORT int32_t OSAtomicDecrement32Barrier(volatile int32_t *dst) +{ + return InterlockedDecrement((volatile long *)dst); +} + +CF_EXPORT int32_t OSAtomicIncrement32Barrier(volatile int32_t *dst) +{ + return InterlockedIncrement((volatile long *)dst); +} + +CF_EXPORT int32_t OSAtomicAdd32Barrier( int32_t theAmount, volatile int32_t *theValue ) { + return (InterlockedExchangeAdd((volatile LONG *)theValue, theAmount) + theAmount); +} + +CF_EXPORT bool OSAtomicCompareAndSwap32Barrier(int32_t oldValue, int32_t newValue, volatile int32_t *theValue) { + return oldValue == InterlockedCompareExchange((long *)theValue, newValue, oldValue); +} + +CF_EXPORT int32_t OSAtomicAdd32( int32_t theAmount, volatile int32_t *theValue ) { + return (InterlockedExchangeAdd((volatile LONG *)theValue, theAmount) + theAmount); +} + +CF_EXPORT int32_t OSAtomicIncrement32(volatile int32_t *theValue) { + return InterlockedIncrement((volatile long *)theValue); +} + +CF_EXPORT int32_t OSAtomicDecrement32(volatile int32_t *theValue) { + return InterlockedDecrement((volatile long *)theValue); +} + +// These 64-bit versions of InterlockedCompareExchange are only available on client Vista and later, so we can't use them (yet). +/* +CF_EXPORT bool OSAtomicCompareAndSwap64( int64_t __oldValue, int64_t __newValue, volatile int64_t *__theValue ) { + return __oldValue == InterlockedCompareExchange64((volatile LONGLONG *)__theValue, __newValue, __oldValue); +} + +CF_EXPORT bool OSAtomicCompareAndSwap64Barrier( int64_t __oldValue, int64_t __newValue, volatile int64_t *__theValue ) { + return __oldValue == InterlockedCompareExchange64((volatile LONGLONG *)__theValue, __newValue, __oldValue); +} + +CF_EXPORT int64_t OSAtomicAdd64( int64_t __theAmount, volatile int64_t *__theValue ) { + return (InterlockedExchangeAdd64((volatile LONGLONG *)__theValue, __theAmount) + __theAmount); +} + +CF_EXPORT int64_t OSAtomicAdd64Barrier( int64_t __theAmount, volatile int64_t *__theValue ) { + retun (InterlockedExchangeAdd64((volatile LONGLONG *)__theValue, __theAmount) + __theAmount); +} + */ + +void OSMemoryBarrier() { + MemoryBarrier(); +} + +void _CFGetFrameworkPath(wchar_t *path, int maxLength) { +#ifdef _DEBUG + // might be nice to get this from the project file at some point + wchar_t *DLLFileName = L"CoreFoundation_debug.dll"; +#else + wchar_t *DLLFileName = L"CoreFoundation.dll"; +#endif + path[0] = path[1] = 0; + DWORD wResult; + CFIndex idx; + HMODULE ourModule = GetModuleHandleW(DLLFileName); + + CFAssert(ourModule, __kCFLogAssertion, "GetModuleHandle failed"); + + wResult = GetModuleFileNameW(ourModule, path, maxLength); + CFAssert1(wResult > 0, __kCFLogAssertion, "GetModuleFileName failed: %d", GetLastError()); + CFAssert1(wResult < maxLength, __kCFLogAssertion, "GetModuleFileName result truncated: %s", path); + + // strip off last component, the DLL name + for (idx = wResult - 1; idx; idx--) { + if ('\\' == path[idx]) { + path[idx] = '\0'; + break; + } + } +} + + +#endif + diff --git a/Info.plist b/Info.plist index 93f14c1..c16df1a 100644 --- a/Info.plist +++ b/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 6.7 + 6.7.1 CFBundleSignature ???? CFBundleVersion diff --git a/MakefileLinux b/MakefileLinux index 7070ab7..43bc87c 100644 --- a/MakefileLinux +++ b/MakefileLinux @@ -30,10 +30,7 @@ CFLAGS=-c -x c -fblocks -fpic -pipe -std=gnu99 -Wno-trigraphs -fexceptions -DCF_ LFLAGS=-shared -fpic -init=___CFInitialize -Wl,--no-undefined,-soname,libCoreFoundation.so # Libs for open source version of ICU -#LIBS=-lc -lpthread -lm -lrt -licuuc -licudata -licui18n -lBlocksRuntime - -# Libs for Apple version of ICU -LIBS=-lc -lpthread -lm -lrt -licucore -lBlocksRuntime +LIBS=-lc -lpthread -lm -lrt -licuuc -licudata -licui18n -lBlocksRuntime .PHONY: all install clean .PRECIOUS: $(OBJBASE)/CoreFoundation/%.h diff --git a/MakefileVersion b/MakefileVersion index 0755f30..00dd41d 100644 --- a/MakefileVersion +++ b/MakefileVersion @@ -1 +1 @@ -VERSION=635 +VERSION=635.15 -- 2.45.2