]> git.saurik.com Git - apple/cf.git/commitdiff
CF-368.27.tar.gz mac-os-x-1047ppc mac-os-x-1047x86 mac-os-x-1048ppc mac-os-x-1048x86 v368.27
authorApple <opensource@apple.com>
Mon, 7 Aug 2006 22:19:04 +0000 (22:19 +0000)
committerApple <opensource@apple.com>
Mon, 7 Aug 2006 22:19:04 +0000 (22:19 +0000)
12 files changed:
AppServices.subproj/CFUserNotification.c
Base.subproj/CFFileUtilities.c
Base.subproj/CFInternal.h
Makefile
Parsing.subproj/CFPropertyList.c
PlugIn.subproj/CFBundle.c
PlugIn.subproj/CFBundle_Internal.h
PlugIn.subproj/CFPlugIn_PlugIn.c
Preferences.subproj/CFApplicationPreferences.c
RunLoop.subproj/CFMessagePort.c
String.subproj/CFStringEncodings.c
framework.make

index 35e9d191f99aa7273a8909d62177debe38406dfd..e915640664aa47279bdbbff964b6c40c8392cda2 100644 (file)
@@ -32,6 +32,7 @@
 #include <CoreFoundation/CFRunLoop.h>
 #include "CFInternal.h"
 
 #include <CoreFoundation/CFRunLoop.h>
 #include "CFInternal.h"
 
+
 #define __kCFLogUserNotification      20
 #define CFUserNotificationLog(alertHeader, alertMessage) CFLog(__kCFLogUserNotification, CFSTR("%@:  %@"), alertHeader, alertMessage);
 
 #define __kCFLogUserNotification      20
 #define CFUserNotificationLog(alertHeader, alertMessage) CFLog(__kCFLogUserNotification, CFSTR("%@:  %@"), alertHeader, alertMessage);
 
index 21913a32f6d0b81a18098c39be2c9daa720a5e9c..9a17577b23b6b19020630a8ac4e21fe1b8731669 100644 (file)
@@ -102,6 +102,7 @@ __private_extern__ Boolean _CFReadBytesFromFile(CFAllocatorRef alloc, CFURLRef u
 
     *bytes = NULL;
 
 
     *bytes = NULL;
 
+    
 #if defined(__WIN32__)
     fd = open(path, O_RDONLY|CF_OPENFLGS, 0666|_S_IREAD);
 #else
 #if defined(__WIN32__)
     fd = open(path, O_RDONLY|CF_OPENFLGS, 0666|_S_IREAD);
 #else
index 5cc43ae5e9efc4c9a7f201fb6b6f225e3d423356..471aa924e0fd5794a52fbe1a6212b15d9f084807 100644 (file)
@@ -56,6 +56,7 @@
 #include "auto_stubs.h"
 #include <libkern/OSAtomic.h>
 
 #include "auto_stubs.h"
 #include <libkern/OSAtomic.h>
 
+
 #if defined(__MACH__)
 #if defined(__ppc__)
 // This hack is in here because B&I kernel does not set up comm page with Tiger additions yet.
 #if defined(__MACH__)
 #if defined(__ppc__)
 // This hack is in here because B&I kernel does not set up comm page with Tiger additions yet.
index 16e7baee9341cbec8069b0a4f671abbc593c6701..a2c1e5e349299eed785f5c5cc0d167fb33c3205a 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -74,7 +74,7 @@ include framework.make
 # Misc additional options
 #
 
 # Misc additional options
 #
 
-CURRENT_PROJECT_VERSION = 368.26
+CURRENT_PROJECT_VERSION = 368.27
 
 # common items all build styles should be defining
 CFLAGS += -DCF_BUILDING_CF=1
 
 # common items all build styles should be defining
 CFLAGS += -DCF_BUILDING_CF=1
index e173b1dc7d7752e5caaa69bd5ebebbc5a05208d6..087bd3211b7b6c462869dc704fac7db9f25adf47 100644 (file)
@@ -43,6 +43,7 @@
 #include <math.h>
 #include <ctype.h>
 
 #include <math.h>
 #include <ctype.h>
 
+
 __private_extern__ bool allowMissingSemi = false;
 
 // Should move this somewhere else
 __private_extern__ bool allowMissingSemi = false;
 
 // Should move this somewhere else
index 3586455b5bf5868a07b5e8c71273c466ad31f0ca..711467f6308d69790da4fd8fc8f14b4976b06c23 100644 (file)
@@ -78,6 +78,7 @@
 #endif
 #endif
 
 #endif
 #endif
 
+
 // Public CFBundle Info plist keys
 CONST_STRING_DECL(kCFBundleInfoDictionaryVersionKey, "CFBundleInfoDictionaryVersion")
 CONST_STRING_DECL(kCFBundleExecutableKey, "CFBundleExecutable")
 // Public CFBundle Info plist keys
 CONST_STRING_DECL(kCFBundleInfoDictionaryVersionKey, "CFBundleInfoDictionaryVersion")
 CONST_STRING_DECL(kCFBundleExecutableKey, "CFBundleExecutable")
@@ -2315,6 +2316,7 @@ Boolean CFBundleLoadExecutable(CFBundleRef bundle) {
             CFLog(__kCFLogBundle, CFSTR("Cannot recognize type of executable for %@"), bundle);
             break;
     }
             CFLog(__kCFLogBundle, CFSTR("Cannot recognize type of executable for %@"), bundle);
             break;
     }
+    if (result && bundle->_plugInData._isPlugIn) _CFBundlePlugInLoaded(bundle);
     
     return result;
 }
     
     return result;
 }
@@ -2685,11 +2687,13 @@ static void _CFBundleEnsureBundleExistsForImagePath(CFStringRef imagePath) {
     // If an image path corresponds to a bundle, we see if there is already a bundle instance.  If there is and it is NOT in the _dynamicBundles array, it is added to the staticBundles.  Do not add the main bundle to the list here.
     CFBundleRef bundle;
     CFURLRef curURL = _CFBundleCopyFrameworkURLForExecutablePath(NULL, imagePath);
     // If an image path corresponds to a bundle, we see if there is already a bundle instance.  If there is and it is NOT in the _dynamicBundles array, it is added to the staticBundles.  Do not add the main bundle to the list here.
     CFBundleRef bundle;
     CFURLRef curURL = _CFBundleCopyFrameworkURLForExecutablePath(NULL, imagePath);
+    Boolean doFinalProcessing = false;
 
     if (curURL != NULL) {
         bundle = _CFBundleFindByURL(curURL, true);
         if (bundle == NULL) {
 
     if (curURL != NULL) {
         bundle = _CFBundleFindByURL(curURL, true);
         if (bundle == NULL) {
-            bundle = _CFBundleCreate(NULL, curURL, true, true);
+            bundle = _CFBundleCreate(NULL, curURL, true, false);
+            doFinalProcessing = true;
         }
         if (bundle != NULL && !bundle->_isLoaded) {
             // make sure that these bundles listed as loaded, and mark them frameworks (we probably can't see anything else here, and we cannot unload them)
         }
         if (bundle != NULL && !bundle->_isLoaded) {
             // make sure that these bundles listed as loaded, and mark them frameworks (we probably can't see anything else here, and we cannot unload them)
@@ -2704,6 +2708,16 @@ static void _CFBundleEnsureBundleExistsForImagePath(CFStringRef imagePath) {
 #endif /* BINARY_SUPPORT_DYLD */
             bundle->_isLoaded = true;
         }
 #endif /* BINARY_SUPPORT_DYLD */
             bundle->_isLoaded = true;
         }
+        // Perform delayed final processing steps.
+        // This must be done after _isLoaded has been set.
+        if (bundle && doFinalProcessing) {
+            _CFBundleCheckWorkarounds(bundle);
+            if (_CFBundleNeedsInitPlugIn(bundle)) {
+                __CFSpinUnlock(&CFBundleGlobalDataLock);
+                _CFBundleInitPlugIn(bundle);
+                __CFSpinLock(&CFBundleGlobalDataLock);
+            }
+        }
         CFRelease(curURL);
     }
 }
         CFRelease(curURL);
     }
 }
index 503bf36c4ed99b68e36cd4eb7816b73550e41e8d..3f6be1f9be08a2a7c041641906a1c56935ede5f7 100644 (file)
@@ -138,6 +138,7 @@ extern void *_CFBundleDLLGetSymbolByName(CFBundleRef bundle, CFStringRef symbolN
 
 extern Boolean _CFBundleNeedsInitPlugIn(CFBundleRef bundle);
 extern void _CFBundleInitPlugIn(CFBundleRef bundle);
 
 extern Boolean _CFBundleNeedsInitPlugIn(CFBundleRef bundle);
 extern void _CFBundleInitPlugIn(CFBundleRef bundle);
+extern void _CFBundlePlugInLoaded(CFBundleRef bundle);
 extern void _CFBundleDeallocatePlugIn(CFBundleRef bundle);
 
 extern void _CFPlugInWillUnload(CFPlugInRef plugIn);
 extern void _CFBundleDeallocatePlugIn(CFBundleRef bundle);
 
 extern void _CFPlugInWillUnload(CFPlugInRef plugIn);
index 4e461aab47a914bd855434fa9b7e5fc6ca7dc329..2f139cad27fef737f00288acf69a6abf8f2390d8 100644 (file)
@@ -28,6 +28,7 @@
 #include "CFBundle_Internal.h"
 #include "CFInternal.h"
 
 #include "CFBundle_Internal.h"
 #include "CFInternal.h"
 
+
 static void _registerFactory(const void *key, const void *val, void *context) {
     CFStringRef factoryIDStr = (CFStringRef)key;
     CFStringRef factoryFuncStr = (CFStringRef)val;
 static void _registerFactory(const void *key, const void *val, void *context) {
     CFStringRef factoryIDStr = (CFStringRef)key;
     CFStringRef factoryFuncStr = (CFStringRef)val;
@@ -120,32 +121,44 @@ __private_extern__ void _CFBundleInitPlugIn(CFBundleRef bundle) {
         CFDictionaryApplyFunction(typeDict, _registerType, bundle);
     }
 
         CFDictionaryApplyFunction(typeDict, _registerType, bundle);
     }
 
-    /* Now do dynamic registration if necessary */
+    /* Now set key for dynamic registration if necessary */
     if (doDynamicReg) {
     if (doDynamicReg) {
+        CFDictionarySetValue((CFMutableDictionaryRef)infoDict, CFSTR("CFPlugInNeedsDynamicRegistration"), CFSTR("YES"));
+        if (CFBundleIsExecutableLoaded(bundle)) _CFBundlePlugInLoaded(bundle);
+    }
+}
+
+__private_extern__ void _CFBundlePlugInLoaded(CFBundleRef bundle) {
+    CFDictionaryRef infoDict = CFBundleGetInfoDictionary(bundle);
+    CFStringRef tempStr;
+    CFPlugInDynamicRegisterFunction func = NULL;
+
+    if (!__CFBundleGetPlugInData(bundle)->_isPlugIn || __CFBundleGetPlugInData(bundle)->_isDoingDynamicRegistration || !infoDict || !CFBundleIsExecutableLoaded(bundle)) return;
+
+    tempStr = CFDictionaryGetValue(infoDict, CFSTR("CFPlugInNeedsDynamicRegistration"));
+    if (tempStr != NULL && CFGetTypeID(tempStr) == CFStringGetTypeID() && CFStringCompare(tempStr, CFSTR("YES"), kCFCompareCaseInsensitive) == kCFCompareEqualTo) {
+        CFDictionaryRemoveValue((CFMutableDictionaryRef)infoDict, CFSTR("CFPlugInNeedsDynamicRegistration"));
         tempStr = CFDictionaryGetValue(infoDict, kCFPlugInDynamicRegisterFunctionKey);
         if (tempStr == NULL || CFGetTypeID(tempStr) != CFStringGetTypeID() || CFStringGetLength(tempStr) <= 0) {
             tempStr = CFSTR("CFPlugInDynamicRegister");
         }
         __CFBundleGetPlugInData(bundle)->_loadOnDemand = false;
         tempStr = CFDictionaryGetValue(infoDict, kCFPlugInDynamicRegisterFunctionKey);
         if (tempStr == NULL || CFGetTypeID(tempStr) != CFStringGetTypeID() || CFStringGetLength(tempStr) <= 0) {
             tempStr = CFSTR("CFPlugInDynamicRegister");
         }
         __CFBundleGetPlugInData(bundle)->_loadOnDemand = false;
+        __CFBundleGetPlugInData(bundle)->_isDoingDynamicRegistration = true;
 
 
-        if (CFBundleLoadExecutable(bundle)) {
-            CFPlugInDynamicRegisterFunction func = NULL;
-
-            __CFBundleGetPlugInData(bundle)->_isDoingDynamicRegistration = true;
-
-            /* Find the symbol and call it. */
-            func = (CFPlugInDynamicRegisterFunction)CFBundleGetFunctionPointerForName(bundle, tempStr);
-            if (func) {
-                func(bundle);
-                // MF:!!! Unload function is never called.  Need to deal with this!
-            }
+        /* Find the symbol and call it. */
+        func = (CFPlugInDynamicRegisterFunction)CFBundleGetFunctionPointerForName(bundle, tempStr);
+        if (func) {
+            func(bundle);
+            // MF:!!! Unload function is never called.  Need to deal with this!
+        }
 
 
-            __CFBundleGetPlugInData(bundle)->_isDoingDynamicRegistration = false;
-            if (__CFBundleGetPlugInData(bundle)->_loadOnDemand && (__CFBundleGetPlugInData(bundle)->_instanceCount == 0)) {
-                /* Unload now if we can/should. */
-                CFBundleUnloadExecutable(bundle);
-            }
+        __CFBundleGetPlugInData(bundle)->_isDoingDynamicRegistration = false;
+        if (__CFBundleGetPlugInData(bundle)->_loadOnDemand && (__CFBundleGetPlugInData(bundle)->_instanceCount == 0)) {
+            /* Unload now if we can/should. */
+            CFBundleUnloadExecutable(bundle);
         }
         }
+    } else {
+        CFDictionaryRemoveValue((CFMutableDictionaryRef)infoDict, CFSTR("CFPlugInNeedsDynamicRegistration"));
     }
 }
 
     }
 }
 
@@ -169,7 +182,8 @@ UInt32 CFPlugInGetTypeID(void) {
 }
 
 CFPlugInRef CFPlugInCreate(CFAllocatorRef allocator, CFURLRef plugInURL) {
 }
 
 CFPlugInRef CFPlugInCreate(CFAllocatorRef allocator, CFURLRef plugInURL) {
-    return (CFPlugInRef)CFBundleCreate(allocator, plugInURL);
+    CFBundleRef bundle = CFBundleCreate(allocator, plugInURL);
+    return (CFPlugInRef)bundle;
 }
 
 CFBundleRef CFPlugInGetBundle(CFPlugInRef plugIn) {
 }
 
 CFBundleRef CFPlugInGetBundle(CFPlugInRef plugIn) {
index 764e68c78f23aba51e96efe7d50b05b0a4a63fb3..36a026d6327e89c1faa9777a176f0bc9dae2afe5 100644 (file)
@@ -30,6 +30,7 @@
 #include <CoreFoundation/CFUniChar.h>
 #include <CoreFoundation/CFNumber.h>
 
 #include <CoreFoundation/CFUniChar.h>
 #include <CoreFoundation/CFNumber.h>
 
+
 static Boolean _CFApplicationPreferencesSynchronizeNoLock(_CFApplicationPreferences *self);
 void _CFPreferencesDomainSetMultiple(CFPreferencesDomainRef domain, CFDictionaryRef dict);
 static void updateDictRep(_CFApplicationPreferences *self);
 static Boolean _CFApplicationPreferencesSynchronizeNoLock(_CFApplicationPreferences *self);
 void _CFPreferencesDomainSetMultiple(CFPreferencesDomainRef domain, CFDictionaryRef dict);
 static void updateDictRep(_CFApplicationPreferences *self);
index 2ca7e965594c83c8726c2e15aa50d14b784b38a7..932f3a80b5ac77eb66e8d52d1ee594d22555c52a 100644 (file)
@@ -41,6 +41,7 @@
 #include <math.h>
 #include <mach/mach_time.h>
 
 #include <math.h>
 #include <mach/mach_time.h>
 
+
 #define __kCFMessagePortMaxNameLengthMax 255
 
 #if defined(BOOTSTRAP_MAX_NAME_LEN)
 #define __kCFMessagePortMaxNameLengthMax 255
 
 #if defined(BOOTSTRAP_MAX_NAME_LEN)
@@ -647,7 +648,7 @@ SInt32 CFMessagePortSendRequest(CFMessagePortRef remote, SInt32 msgid, CFDataRef
     Boolean didRegister = false;
     kern_return_t ret;
 
     Boolean didRegister = false;
     kern_return_t ret;
 
-//#warning CF: This should be an assert
+    //#warning CF: This should be an assert
     // if (!__CFMessagePortIsRemote(remote)) return -999;
     if (!__CFMessagePortIsValid(remote)) return kCFMessagePortIsInvalid;
     __CFMessagePortLock(remote);
     // if (!__CFMessagePortIsRemote(remote)) return -999;
     if (!__CFMessagePortIsValid(remote)) return kCFMessagePortIsInvalid;
     __CFMessagePortLock(remote);
index c85bc11eeb177de75726d58f7bc2eef4a17e3c6c..a3d999e488e7b6f47867a22fa3e8136d27704a19 100644 (file)
@@ -824,11 +824,12 @@ Boolean CFStringGetFileSystemRepresentation(CFStringRef string, char *buffer, CF
 #if defined(__MACH__)
 #define MAX_STACK_BUFFER_LEN   (255)
     const UTF16Char *characters = CFStringGetCharactersPtr(string);
 #if defined(__MACH__)
 #define MAX_STACK_BUFFER_LEN   (255)
     const UTF16Char *characters = CFStringGetCharactersPtr(string);
+    CFIndex length = CFStringGetLength(string);
     uint32_t usedBufLen;
 
     uint32_t usedBufLen;
 
-    if (NULL == characters) {
-        CFIndex length = CFStringGetLength(string);
+    if (maxBufLen < length) return false; // Since we're using UTF-8, the byte length is never shorter than the char length. Also, it filters out 0 == maxBufLen
 
 
+    if (NULL == characters) {
         if (length > MAX_STACK_BUFFER_LEN) {
             UTF16Char charactersBuffer[MAX_STACK_BUFFER_LEN];
             CFRange range = CFRangeMake(0, MAX_STACK_BUFFER_LEN);
         if (length > MAX_STACK_BUFFER_LEN) {
             UTF16Char charactersBuffer[MAX_STACK_BUFFER_LEN];
             CFRange range = CFRangeMake(0, MAX_STACK_BUFFER_LEN);
@@ -836,7 +837,7 @@ Boolean CFStringGetFileSystemRepresentation(CFStringRef string, char *buffer, CF
 
             usedBufLen = 0;
 
 
             usedBufLen = 0;
 
-            while (length > 0) {
+            while ((length > 0) && (maxBufLen > usedBufLen)) {
                 CFStringGetCharacters(string, range, charactersBuffer);
                 if (CFUniCharIsSurrogateHighCharacter(charactersBuffer[range.length - 1])) --range.length; // Backup for a high surrogate
 
                 CFStringGetCharacters(string, range, charactersBuffer);
                 if (CFUniCharIsSurrogateHighCharacter(charactersBuffer[range.length - 1])) --range.length; // Backup for a high surrogate
 
@@ -856,7 +857,7 @@ Boolean CFStringGetFileSystemRepresentation(CFStringRef string, char *buffer, CF
             buffer += usedBufLen;
         }
     } else {
             buffer += usedBufLen;
         }
     } else {
-        if (!CFUniCharDecompose(characters, CFStringGetLength(string), NULL, (void *)buffer, maxBufLen, &usedBufLen, true, kCFUniCharUTF8Format, true)) return false;
+        if (!CFUniCharDecompose(characters, length, NULL, (void *)buffer, maxBufLen, &usedBufLen, true, kCFUniCharUTF8Format, true)) return false;
         buffer += usedBufLen;
     }
 
         buffer += usedBufLen;
     }
 
index 2f70262402f21893a2e6e9742d1a09c84b14aa05..34431c8d7ddf56c29772e74f2a411a45545a6e92 100755 (executable)
@@ -131,8 +131,8 @@ endif
 #
 
 ifeq "$(PLATFORM)" "Darwin"
 #
 
 ifeq "$(PLATFORM)" "Darwin"
-C_WARNING_FLAGS += -Wno-four-char-constants -Wall
-CPP_WARNING_FLAGS += -Wno-four-char-constants -Wall
+C_WARNING_FLAGS += -Wno-precomp -Wno-four-char-constants -Wall
+CPP_WARNING_FLAGS += -Wno-precomp -Wno-four-char-constants -Wall
 endif
 
 ifeq "$(PLATFORM)" "CYGWIN"
 endif
 
 ifeq "$(PLATFORM)" "CYGWIN"