]> git.saurik.com Git - apple/cf.git/commitdiff
CF-1153.18.tar.gz master os-x-10103 os-x-10104 os-x-10105 v1153.18
authorApple <opensource@apple.com>
Tue, 23 Jun 2015 22:35:45 +0000 (22:35 +0000)
committerApple <opensource@apple.com>
Tue, 23 Jun 2015 22:35:45 +0000 (22:35 +0000)
14 files changed:
CFAvailability.h
CFCharacterSetBitmaps.bitmap
CFDateFormatter.c
CFPriv.h
CFSocket.c
CFString.c
CFStringEncodingConverter.c
CFStringEncodings.c
CFURLPriv.h
CFUniCharPropertyDatabase.data
CFUnicodeData-B.mapping
CFUnicodeData-L.mapping
CFVersion.c
MakefileVersion

index 76a14b009cbd48821ef71708ffd5c69da8257fca..fb1d44db3be6dae487286bd25a575fd7bddbd842 100644 (file)
@@ -82,6 +82,7 @@
 #define __NSi_10_9 introduced=10.9
 #define __NSi_10_10 introduced=10.10
 #define __NSi_10_10_2 introduced=10.10.2
 #define __NSi_10_9 introduced=10.9
 #define __NSi_10_10 introduced=10.10
 #define __NSi_10_10_2 introduced=10.10.2
+#define __NSi_10_10_3 introduced=10.10.3
 
 #define __NSd_2_0 ,deprecated=2.0
 #define __NSd_2_1 ,deprecated=2.1
 
 #define __NSd_2_0 ,deprecated=2.0
 #define __NSd_2_1 ,deprecated=2.1
 #define __NSd_10_9 ,deprecated=10.9
 #define __NSd_10_10 ,deprecated=10.10
 #define __NSd_10_10_2 ,deprecated=10.10.2
 #define __NSd_10_9 ,deprecated=10.9
 #define __NSd_10_10 ,deprecated=10.10
 #define __NSd_10_10_2 ,deprecated=10.10.2
+#define __NSd_10_10_3 ,deprecated=10.10.3
 
 #define __NSi_NA unavailable
 #define __NSd_NA
 
 #define __NSi_NA unavailable
 #define __NSd_NA
index 81fa63db5ca3004f01d8481036243b1b497a01d8..1e52a8d5826410a31dcd1849f3f36fae6e7cc508 100644 (file)
Binary files a/CFCharacterSetBitmaps.bitmap and b/CFCharacterSetBitmaps.bitmap differ
index 71c5da06bed6fffd8d38bc7c7ca536641bb37eee..0021d496a3287437197aa42af5a3fc01761fcf49 100644 (file)
@@ -1154,7 +1154,7 @@ static CFStringRef __CFDateFormatterCreateForcedString(CFDateFormatterRef format
         } else if (err == U_BUFFER_OVERFLOW_ERROR) {
             err = U_ZERO_ERROR;
             UChar *largerBuffer = calloc(newPatternLen + 1, sizeof(UChar));
         } else if (err == U_BUFFER_OVERFLOW_ERROR) {
             err = U_ZERO_ERROR;
             UChar *largerBuffer = calloc(newPatternLen + 1, sizeof(UChar));
-            newPatternLen = uadatpg_remapPatternWithOptions(ptg, ustr, cnt, options, outBuffer, newPatternLen + 1, &err);
+            newPatternLen = uadatpg_remapPatternWithOptions(ptg, ustr, cnt, options, largerBuffer, newPatternLen + 1, &err);
             if (U_SUCCESS(err)) {
                 result = CFStringCreateWithCharacters(kCFAllocatorSystemDefault, largerBuffer, newPatternLen);
             }
             if (U_SUCCESS(err)) {
                 result = CFStringCreateWithCharacters(kCFAllocatorSystemDefault, largerBuffer, newPatternLen);
             }
index 475a4b27493a978f25e3d13418349ab5cc7fb3e6..72131bc34060a17c8bf5e3769148a267430b655f 100644 (file)
--- a/CFPriv.h
+++ b/CFPriv.h
@@ -497,7 +497,7 @@ void CFCharacterSetInitInlineBuffer(CFCharacterSetRef cset, CFCharacterSetInline
  @result true, if the value is in the character set, otherwise false.
  */
 #if defined(CF_INLINE)
  @result true, if the value is in the character set, otherwise false.
  */
 #if defined(CF_INLINE)
-CF_INLINE bool CFCharacterSetInlineBufferIsLongCharacterMember(CFCharacterSetInlineBuffer *buffer, UTF32Char character) {
+CF_INLINE bool CFCharacterSetInlineBufferIsLongCharacterMember(const CFCharacterSetInlineBuffer *buffer, UTF32Char character) {
     bool isInverted = ((0 == (buffer->flags & kCFCharacterSetIsInverted)) ? false : true);
 
     if ((character >= buffer->rangeStart) && (character < buffer->rangeLimit)) {
     bool isInverted = ((0 == (buffer->flags & kCFCharacterSetIsInverted)) ? false : true);
 
     if ((character >= buffer->rangeStart) && (character < buffer->rangeLimit)) {
index 0fa2d04d433f3f23be7fbb0d94cd29a89d311f13..5771abba9b59580185fd2980985274388f26d323 100644 (file)
@@ -1672,46 +1672,21 @@ static void __CFSocketHandleRead(CFSocketRef s, Boolean causedByTimeout)
                        if (ctRemaining > 0) {
                                base = CFDataGetMutableBytePtr(s->_readBuffer);
 
                        if (ctRemaining > 0) {
                                base = CFDataGetMutableBytePtr(s->_readBuffer);
 
-                                struct timeval timeBeforeRead = { 0 };
-                                gettimeofday(&timeBeforeRead, NULL);
-
-                                struct timeval deadlineTime = { 0 };
-                                timeradd(&timeBeforeRead, &s->_readBufferTimeout, &deadlineTime);
-
-                                struct timeval timeAfterRead = { 0 };
-
-                                while (1) {
-                                    ctRead = read(CFSocketGetNative(s), &base[s->_bytesToBufferPos], ctRemaining);
-
-                                    if (ctRead >= 0) {
-                                        break;
-                                    }
-
-                                    if (errno != EAGAIN) {
-                                        break;
-                                    }
-
-                                    gettimeofday(&timeAfterRead, NULL);
-
-                                    if (timercmp(&timeAfterRead, &deadlineTime, >)) {
-#if defined(LOG_CFSOCKET)
-                                        CFSocketNativeHandle fd = CFSocketGetNative(s);
-                                        CFStringRef peerName = copyPeerAddress(kCFAllocatorDefault, fd);
-                                        CFStringRef localName = copyLocalAddress(kCFAllocatorDefault, fd);
-                                        CFLog(kCFLogLevelCritical, CFSTR("ERROR: Buffered read of %llu bytes failed for fd %d (socket valid? %d fd valid? %d %@ => %@)"), ctRemaining, fd, __CFSocketIsValid(s), __CFNativeSocketIsValid(fd), localName, peerName);
-                                        if (peerName)
-                                            CFRelease(peerName);
-                                        if (localName)
-                                            CFRelease(localName);
-#endif
-                                        break;
-                                    }
-                                }
+                                ctRead = read(CFSocketGetNative(s), &base[s->_bytesToBufferPos], ctRemaining);
 
                                switch (ctRead) {
                                case -1:
 
                                switch (ctRead) {
                                case -1:
-                                       s->_bufferedReadError = errno;
-                                       s->_atEOF = true;
+                                        if (errno == EAGAIN) { // no error
+                                            __CFLock(&__CFActiveSocketsLock);
+                                            /* restore socket to fds */
+                                            __CFSocketSetFDForRead(s);
+                                            __CFUnlock(&__CFActiveSocketsLock);
+                                            __CFSocketUnlock(s);
+                                            return;
+                                        } else {
+                                            s->_bufferedReadError = errno;
+                                            s->_atEOF = true;
+                                        }
 #if defined(LOG_CFSOCKET)
                                        fprintf(stderr, "BUFFERED READ GOT ERROR %d\n", errno);
 #endif
 #if defined(LOG_CFSOCKET)
                                        fprintf(stderr, "BUFFERED READ GOT ERROR %d\n", errno);
 #endif
index 92ae1eb3e281a3acb87060751acd2398696eacd0..74527d434afab66fbbb36a24fb34aeb1193a581e 100644 (file)
@@ -3398,6 +3398,98 @@ enum {
     kCFStringHangulStateBreak
 };
 
     kCFStringHangulStateBreak
 };
 
+static const CFCharacterSetInlineBuffer *__CFStringGetFitzpatrickModifierBaseCharacterSet(void) {
+    static CFCharacterSetInlineBuffer buffer;
+    static dispatch_once_t initOnce;
+    dispatch_once(&initOnce, ^{ // based on UTR#51 1.0 (draft 7) for Unicode 8.0
+        /*
+         U+261D WHITE UP POINTING INDEX
+         U+2639 WHITE FROWNING FACE…U+263A WHITE SMILING FACE
+         U+270A RAISED FIST…U+270D WRITING HAND
+         U+1F385 FATHER CHRISTMAS
+         U+1F3C2 SNOWBOARDER…U+1F3C4 SURFER
+         U+1F3C7 HORSE RACING
+         U+1F3CA SWIMMER
+         U+1F442 EAR…U+1F443 NOSE
+         U+1F446 WHITE UP POINTING BACKHAND INDEX…U+1F450 OPEN HANDS SIGN
+         U+1F466 BOY…U+1F469 WOMAN
+         U+1F46E POLICE OFFICER…U+1F478 PRINCESS
+         U+1F47C BABY ANGEL
+         U+1F47F IMP
+         U+1F481 INFORMATION DESK PERSON…U+1F482 GUARDSMAN
+         U+1F483 DANCER
+         U+1F485 NAIL POLISH
+         U+1F486 FACE MASSAGE…U+1F487 HAIRCUT
+         U+1F4AA FLEXED BICEPS
+         U+1F590 RAISED HAND WITH FINGERS SPLAYED
+         U+1F595 REVERSED HAND WITH MIDDLE FINGER EXTENDED…U+1F596 RAISED HAND WITH PART BETWEEN MIDDLE AND RING FINGERS
+         U+1F600 GRINNING FACE…U+1F637 FACE WITH MEDICAL MASK
+         U+1F641 SLIGHTLY FROWNING FACE…U+1F642 SLIGHTLY SMILING FACE
+         U+1F645 FACE WITH NO GOOD GESTURE…U+1F647 PERSON BOWING DEEPLY
+         U+1F64B HAPPY PERSON RAISING ONE HAND
+         U+1F64C PERSON RAISING BOTH HANDS IN CELEBRATION
+         U+1F64D PERSON FROWNING…U+1F64E PERSON WITH POUTING FACE
+         U+1F64F PERSON WITH FOLDED HANDS
+         U+1F6A3 ROWBOAT
+         U+1F6B4 BICYCLIST…U+1F6B6 PEDESTRIAN
+         U+1F6C0 BATH
+         */
+        CFMutableCharacterSetRef cset = CFCharacterSetCreateMutable(NULL);
+        CFCharacterSetAddCharactersInRange(cset, CFRangeMake(0x261D, 1)); // WHITE UP POINTING INDEX
+        CFCharacterSetAddCharactersInRange(cset, CFRangeMake(0x2639, 2)); // WHITE FROWNING FACE ~ WHITE SMILING FACE
+        CFCharacterSetAddCharactersInRange(cset, CFRangeMake(0x270A, 4)); // RAISED FIST ~ WRITING HAND
+        CFCharacterSetAddCharactersInRange(cset, CFRangeMake(0x1F385, 1)); // FATHER CHRISTMAS
+        CFCharacterSetAddCharactersInRange(cset, CFRangeMake(0x1F3C2, 3)); // SNOWBOARDER ~ SURFER
+        CFCharacterSetAddCharactersInRange(cset, CFRangeMake(0x1F3C7, 1)); // HORSE RACING
+        CFCharacterSetAddCharactersInRange(cset, CFRangeMake(0x1F3CA, 1)); // SWIMMER
+        CFCharacterSetAddCharactersInRange(cset, CFRangeMake(0x1F442, 2)); // EAR ~ NOSE
+        CFCharacterSetAddCharactersInRange(cset, CFRangeMake(0x1F446, 0x1F451 - 0x1F446)); // WHITE UP POINTING BACKHAND INDEX ~ OPEN HANDS SIGN
+        CFCharacterSetAddCharactersInRange(cset, CFRangeMake(0x1F466, 4)); // BOY ~ WOMAN
+        CFCharacterSetAddCharactersInRange(cset, CFRangeMake(0x1F46E, 0x1F479 - 0x1F46E)); // POLICE OFFICER ~ PRINCESS
+        CFCharacterSetAddCharactersInRange(cset, CFRangeMake(0x1F47C, 1)); // BABY ANGEL
+        CFCharacterSetAddCharactersInRange(cset, CFRangeMake(0x1F47F, 1)); // IMP
+        CFCharacterSetAddCharactersInRange(cset, CFRangeMake(0x1F481, 3)); // INFORMATION DESK PERSON ~ DANCER
+        CFCharacterSetAddCharactersInRange(cset, CFRangeMake(0x1F485, 3)); // NAIL POLISH ~ HAIRCUT
+        CFCharacterSetAddCharactersInRange(cset, CFRangeMake(0x1F4AA, 1)); // FLEXED BICEPS
+        CFCharacterSetAddCharactersInRange(cset, CFRangeMake(0x1F590, 1)); // RAISED HAND WITH FINGERS SPLAYED
+        CFCharacterSetAddCharactersInRange(cset, CFRangeMake(0x1F595, 2)); // REVERSED HAND WITH MIDDLE FINGER EXTENDED ~ RAISED HAND WITH PART BETWEEN MIDDLE AND RING FINGERS
+        CFCharacterSetAddCharactersInRange(cset, CFRangeMake(0x1F600, 0x1F638 - 0x1F600)); // GRINNING FACE ~ FACE WITH MEDICAL MASK
+        CFCharacterSetAddCharactersInRange(cset, CFRangeMake(0x1F641, 2)); // SLIGHTLY FROWNING FACE ~ SLIGHTLY SMILING FACE
+        
+        CFCharacterSetAddCharactersInRange(cset, CFRangeMake(0x1F645, 3)); // FACE WITH NO GOOD GESTURE ~ PERSON BOWING DEEPLY
+        CFCharacterSetAddCharactersInRange(cset, CFRangeMake(0x1F64B, 0x1F650 - 0x1F64B)); // HAPPY PERSON RAISING ONE HAND ~ PERSON WITH FOLDED HANDS
+        CFCharacterSetAddCharactersInRange(cset, CFRangeMake(0x1F6A3, 1)); // ROWBOAT
+        CFCharacterSetAddCharactersInRange(cset, CFRangeMake(0x1F6B4, 0x1F6B7 - 0x1F6B4)); // BICYCLIST ~ PEDESTRIAN
+        CFCharacterSetAddCharactersInRange(cset, CFRangeMake(0x1F6C0, 1)); // BATH
+        CFCharacterSetCompact(cset);
+        CFCharacterSetInitInlineBuffer(cset, &buffer);
+    });
+
+    return (const CFCharacterSetInlineBuffer *)&buffer;
+}
+
+static inline bool __CFStringIsFitzpatrickModifiers(UTF32Char character) { return ((character >= 0x1F3FB) && (character <= 0x1F3FF) ? true : false); }
+static inline bool __CFStringIsBaseForFitzpatrickModifiers(UTF32Char character) {
+    if (((character >= 0x2600) && (character < 0x27C0)) || ((character >= 0x1F300) && (character < 0x1F700))) { // Misc symbols, dingbats, & emoticons
+        return (CFCharacterSetInlineBufferIsLongCharacterMember(__CFStringGetFitzpatrickModifierBaseCharacterSet(), character) ? true : false);
+    }
+
+    return false;
+}
+
+static inline bool __CFStringIsFamilySequenceBaseCharacterHigh(UTF16Char character) { return (character == 0xD83D) ? true : false; }
+static inline bool __CFStringIsFamilySequenceBaseCharacterLow(UTF16Char character) { return (((character >= 0xDC66) && (character <= 0xDC69)) || (character == 0xDC8B) ? true : false); }
+static inline bool __CFStringIsFamilySequenceCluster(CFStringInlineBuffer *buffer, CFRange range) {
+    UTF16Char character = CFStringGetCharacterFromInlineBuffer(buffer, range.location);
+
+    if (character == 0x2764) { // HEART
+        return true;
+    } else if (range.length > 1) {
+        if (__CFStringIsFamilySequenceBaseCharacterHigh(character) && __CFStringIsFamilySequenceBaseCharacterLow(CFStringGetCharacterFromInlineBuffer(buffer, range.location + 1))) return true;
+    }
+    return false;
+}
+
 static CFRange _CFStringInlineBufferGetComposedRange(CFStringInlineBuffer *buffer, CFIndex start, CFStringCharacterClusterType type, const uint8_t *bmpBitmap, CFIndex csetType) {
     CFIndex end = start + 1;
     const uint8_t *bitmap = bmpBitmap;
 static CFRange _CFStringInlineBufferGetComposedRange(CFStringInlineBuffer *buffer, CFIndex start, CFStringCharacterClusterType type, const uint8_t *bmpBitmap, CFIndex csetType) {
     CFIndex end = start + 1;
     const uint8_t *bitmap = bmpBitmap;
@@ -3430,7 +3522,19 @@ static CFRange _CFStringInlineBufferGetComposedRange(CFStringInlineBuffer *buffe
                 }
             }
 
                 }
             }
 
-            if (!CFUniCharIsMemberOfBitmap(character, bitmap) && (character != 0xFF9E) && (character != 0xFF9F) && ((character & 0x1FFFF0) != 0xF870)) break;
+            if (__CFStringIsFitzpatrickModifiers(character) && (start > 0)) {
+                UTF32Char baseCharacter = CFStringGetCharacterFromInlineBuffer(buffer, start - 1);
+
+                if (CFUniCharIsSurrogateLowCharacter(baseCharacter) && ((start - 1) > 0)) {
+                    UTF16Char otherCharacter = CFStringGetCharacterFromInlineBuffer(buffer, start - 2);
+
+                    if (CFUniCharIsSurrogateHighCharacter(otherCharacter)) baseCharacter = CFUniCharGetLongCharacterForSurrogatePair(otherCharacter, baseCharacter);
+                }
+
+                if (!__CFStringIsBaseForFitzpatrickModifiers(baseCharacter)) break;
+            } else {
+                if (!CFUniCharIsMemberOfBitmap(character, bitmap) && (character != 0xFF9E) && (character != 0xFF9F) && ((character & 0x1FFFF0) != 0xF870)) break;
+            }
     
             --start;
     
     
             --start;
     
@@ -3522,6 +3626,8 @@ static CFRange _CFStringInlineBufferGetComposedRange(CFStringInlineBuffer *buffe
         }
     }
 
         }
     }
 
+    bool prevIsFitzpatrickBase = __CFStringIsBaseForFitzpatrickModifiers(character);
+
     // Extend forward
     while ((character = CFStringGetCharacterFromInlineBuffer(buffer, end)) > 0) {
         if ((type == kCFStringBackwardDeletionCluster) && (character >= 0x0530) && (character < 0x1950)) break;
     // Extend forward
     while ((character = CFStringGetCharacterFromInlineBuffer(buffer, end)) > 0) {
         if ((type == kCFStringBackwardDeletionCluster) && (character >= 0x0530) && (character < 0x1950)) break;
@@ -3535,7 +3641,9 @@ static CFRange _CFStringInlineBufferGetComposedRange(CFStringInlineBuffer *buffe
             step  = 1;
         }
 
             step  = 1;
         }
 
-        if (!CFUniCharIsMemberOfBitmap(character, bitmap) && (character != 0xFF9E) && (character != 0xFF9F) && ((character & 0x1FFFF0) != 0xF870)) break;
+        if ((!prevIsFitzpatrickBase || !__CFStringIsFitzpatrickModifiers(character)) && !CFUniCharIsMemberOfBitmap(character, bitmap) && (character != 0xFF9E) && (character != 0xFF9F) && ((character & 0x1FFFF0) != 0xF870)) break;
+
+        prevIsFitzpatrickBase = __CFStringIsBaseForFitzpatrickModifiers(character);
 
         end += step;
     } 
 
         end += step;
     } 
@@ -3673,7 +3781,54 @@ CFRange CFStringGetRangeOfCharacterClusterAtIndex(CFStringRef string, CFIndex ch
         }
         ++currentIndex;
     }
         }
         ++currentIndex;
     }
-    
+
+    // Family face sequence
+    CFRange aCluster;
+
+    if (range.location > 1) { // there are more than 2 chars
+        character = CFStringGetCharacterFromInlineBuffer(&stringBuffer, range.location);
+
+        if (__CFStringIsFamilySequenceCluster(&stringBuffer, range) || (character == ZERO_WIDTH_JOINER)) { // extend backward
+            currentIndex = (character == ZERO_WIDTH_JOINER) ? range.location + 1 : range.location;
+
+            while ((currentIndex > 1) && (ZERO_WIDTH_JOINER == CFStringGetCharacterFromInlineBuffer(&stringBuffer, currentIndex - 1))) {
+                aCluster = _CFStringInlineBufferGetComposedRange(&stringBuffer, currentIndex - 2, type, bmpBitmap, csetType);
+
+                if (__CFStringIsFamilySequenceCluster(&stringBuffer, aCluster) && (aCluster.location < range.location)) {
+                    currentIndex = aCluster.location;
+                } else {
+                    break;
+                }
+            }
+
+            if (currentIndex < range.location) {
+                range.length += range.location - currentIndex;
+                range.location = currentIndex;
+            }
+        }
+    }
+
+    // Extend forward
+    if (range.location + range.length < length) {
+        currentIndex = range.location + range.length - 1;
+        character = CFStringGetCharacterFromInlineBuffer(&stringBuffer, currentIndex);
+
+        if ((ZERO_WIDTH_JOINER == character) || __CFStringIsFamilySequenceCluster(&stringBuffer, _CFStringInlineBufferGetComposedRange(&stringBuffer, currentIndex, type, bmpBitmap, csetType))) {
+
+            if (ZERO_WIDTH_JOINER != character) ++currentIndex; // move to the end of cluster
+
+            while (((currentIndex + 1) < length) && (ZERO_WIDTH_JOINER == CFStringGetCharacterFromInlineBuffer(&stringBuffer, currentIndex))) {
+                aCluster = _CFStringInlineBufferGetComposedRange(&stringBuffer, currentIndex + 1, type, bmpBitmap, csetType);
+                if (__CFStringIsFamilySequenceCluster(&stringBuffer, aCluster)) {
+                    currentIndex = aCluster.location + aCluster.length;
+                    if ((aCluster.length > 1) && (ZERO_WIDTH_JOINER == CFStringGetCharacterFromInlineBuffer(&stringBuffer, currentIndex - 1))) --currentIndex;
+                } else {
+                    break;
+                }
+            }
+            if (currentIndex > (range.location + range.length)) range.length = currentIndex - range.location;
+        }
+    }
     return range;
 }
 
     return range;
 }
 
index 546306cdb2dee12e964319bf1249a7a19a4c16c0..f3773bf99b5bf55226e401ef99cad7f5f8f14062 100644 (file)
@@ -768,9 +768,13 @@ uint32_t CFStringEncodingUnicodeToBytes(uint32_t encoding, uint32_t flags, const
                         CFIndex localUsedLen;
 
                         localUsedByteLen = 0;
                         CFIndex localUsedLen;
 
                         localUsedByteLen = 0;
-                        while ((usedLen < numChars && theUsedByteLen < maxByteLen) && !localUsedByteLen && (localUsedLen = TO_BYTE_FALLBACK(converter, characters + usedLen, numChars - usedLen, NULL, 0, &localUsedByteLen))) usedLen += localUsedLen;
-                        
-                        theUsedByteLen += localUsedByteLen;
+                        // after the buffer is full, we still try out all the rest of the characters
+                        // if all characters cannot be converted, we mark the result as insufficient output buffer
+                        while ((usedLen < numChars) && !localUsedByteLen && (localUsedLen = TO_BYTE_FALLBACK(converter, characters + usedLen, numChars - usedLen, NULL, 0, &localUsedByteLen))) {
+                            if (localUsedByteLen == 0) {
+                                usedLen += localUsedLen;
+                            }
+                        }
                     }
                     if (usedLen < numChars) theResult = kCFStringEncodingInsufficientOutputBufferLength;
                     break;
                     }
                     if (usedLen < numChars) theResult = kCFStringEncodingInsufficientOutputBufferLength;
                     break;
@@ -799,9 +803,11 @@ uint32_t CFStringEncodingUnicodeToBytes(uint32_t encoding, uint32_t flags, const
                 CFIndex localUsedLen;
 
                 localUsedByteLen = 0;
                 CFIndex localUsedLen;
 
                 localUsedByteLen = 0;
-                while ((usedLen < numChars && theUsedByteLen < maxByteLen) && !localUsedByteLen && (localUsedLen = TO_BYTE_FALLBACK(converter, characters + usedLen, numChars - usedLen, NULL, 0, &localUsedByteLen))) usedLen += localUsedLen;
-                
-                theUsedByteLen += localUsedByteLen;
+                while ((usedLen < numChars) && !localUsedByteLen && (localUsedLen = TO_BYTE_FALLBACK(converter, characters + usedLen, numChars - usedLen, NULL, 0, &localUsedByteLen))) {
+                    if (!localUsedByteLen) {
+                        usedLen += localUsedLen;
+                    }
+                }
             }
             if (usedLen < numChars) theResult = kCFStringEncodingInsufficientOutputBufferLength;
         }
             }
             if (usedLen < numChars) theResult = kCFStringEncodingInsufficientOutputBufferLength;
         }
index 7f79a2d98f80268927ac51a325d4c6acca26d38b..876e204ed8dfdd782a1eddcf4deffec72eb72d11 100644 (file)
@@ -955,6 +955,8 @@ void _CFStringGetUserDefaultEncoding(UInt32 *oScriptValue, UInt32 *oRegionValue)
 
     if (stringValue) {
         *oScriptValue = strtol_l(stringValue, &stringValue, 0, NULL);
 
     if (stringValue) {
         *oScriptValue = strtol_l(stringValue, &stringValue, 0, NULL);
+        // We force using MacRoman for Arabic/Hebrew users <rdar://problem/17633551> When changing language to Arabic and Hebrew, set the default user encoding to MacRoman, not MacArabic/MacHebrew
+        if ((*oScriptValue == kCFStringEncodingMacArabic) || (*oScriptValue == kCFStringEncodingMacHebrew)) *oScriptValue = kCFStringEncodingMacRoman;
         if (*stringValue == ':') {
             if (oRegionValue) *oRegionValue = strtol_l(++stringValue, NULL, 0, NULL);
             return;
         if (*stringValue == ':') {
             if (oRegionValue) *oRegionValue = strtol_l(++stringValue, NULL, 0, NULL);
             return;
@@ -994,6 +996,8 @@ void _CFStringGetInstallationEncodingAndRegion(uint32_t *encoding, uint32_t *reg
     
     if (stringValue) {
         *encoding = strtol_l(stringValue, &stringValue, 0, NULL);
     
     if (stringValue) {
         *encoding = strtol_l(stringValue, &stringValue, 0, NULL);
+        // We force using MacRoman for Arabic/Hebrew users <rdar://problem/17633551> When changing language to Arabic and Hebrew, set the default user encoding to MacRoman, not MacArabic/MacHebrew
+        if ((*encoding == kCFStringEncodingMacArabic) || (*encoding == kCFStringEncodingMacHebrew)) *encoding = kCFStringEncodingMacRoman;
         if (*stringValue == ':') *region = strtol_l(++stringValue, NULL, 0, NULL);
     }
 }
         if (*stringValue == ':') *region = strtol_l(++stringValue, NULL, 0, NULL);
     }
 }
@@ -1017,6 +1021,8 @@ Boolean _CFStringSaveUserDefaultEncoding(UInt32 iScriptValue, UInt32 iRegionValu
        int fd = open(filename, O_WRONLY|O_CREAT, 0400);
        if (0 <= fd) {
             char buffer[__kCFMaxDefaultEncodingFileLength];
        int fd = open(filename, O_WRONLY|O_CREAT, 0400);
        if (0 <= fd) {
             char buffer[__kCFMaxDefaultEncodingFileLength];
+            // We force using MacRoman for Arabic/Hebrew users <rdar://problem/17633551> When changing language to Arabic and Hebrew, set the default user encoding to MacRoman, not MacArabic/MacHebrew
+            if ((iScriptValue == kCFStringEncodingMacArabic) || (iScriptValue == kCFStringEncodingMacHebrew)) iScriptValue = kCFStringEncodingMacRoman;
             size_t size = snprintf(buffer, __kCFMaxDefaultEncodingFileLength, "0x%X:0x%X", (unsigned int)iScriptValue, (unsigned int)iRegionValue);
            if (size <= __kCFMaxDefaultEncodingFileLength) {
                 int ret = write(fd, buffer, size);
             size_t size = snprintf(buffer, __kCFMaxDefaultEncodingFileLength, "0x%X:0x%X", (unsigned int)iScriptValue, (unsigned int)iRegionValue);
            if (size <= __kCFMaxDefaultEncodingFileLength) {
                 int ret = write(fd, buffer, size);
index 8d4d37ab90851cac25505fd39b8138db3d199e71..b90699acf1af9e594aad1972899fcd5a55300286 100644 (file)
@@ -291,6 +291,23 @@ CF_EXPORT const CFStringRef kCFURLUbiquitousItemDownloadRequestedKey CF_AVAILABL
 CF_EXPORT const CFStringRef kCFURLUbiquitousItemContainerDisplayNameKey CF_AVAILABLE(10_10, 8_0);
     /* Returns the localized name of the ubiquity container that contains this item (Read-only, value type CFString) */
 
 CF_EXPORT const CFStringRef kCFURLUbiquitousItemContainerDisplayNameKey CF_AVAILABLE(10_10, 8_0);
     /* Returns the localized name of the ubiquity container that contains this item (Read-only, value type CFString) */
 
+CF_EXPORT const CFStringRef kCFURLUbiquitousItemIsSharedKey; // true if the ubiquitous item is shared. (Read-only, value type boolean NSNumber)
+
+CF_EXPORT const CFStringRef kCFURLUbiquitousSharedItemRoleKey /*CF_AVAILABLE(10_11, 9_0)*/; // returns the current user's role for this shared item, or nil if not shared. (Read-only, value type NSString). Possible values below.
+CF_EXPORT const CFStringRef kCFURLUbiquitousSharedItemRoleOwner /*CF_AVAILABLE(10_11, 9_0)*/; // the current user is the owner of this shared item.
+CF_EXPORT const CFStringRef kCFURLUbiquitousSharedItemRoleParticipant /*CF_AVAILABLE(10_11, 9_0)*/; // the current user is a participant of this shared item.
+
+CF_EXPORT const CFStringRef kCFURLUbiquitousSharedItemOwnerNameKey /*CF_AVAILABLE(10_11, 9_0)*/; // returns the name of the owner of a shared item, or nil if the current user. (Read-only, value type NSString)
+
+CF_EXPORT const CFStringRef kCFURLUbiquitousSharedItemPermissionsKey /*CF_AVAILABLE(10_11, 9_0)*/; // returns the current user's permissions for this shared item. (Read-only, value type NSString). Possible values below.
+CF_EXPORT const CFStringRef kCFURLUbiquitousSharedItemPermissionsReadOnly /*CF_AVAILABLE(10_11, 9_0)*/; // the user is only allowed to read this item
+CF_EXPORT const CFStringRef kCFURLUbiquitousSharedItemPermissionsReadWrite /*CF_AVAILABLE(10_11, 9_0)*/; // the user is allowed to both read and write this item
+
+// Deprecated. Will be removed.
+CF_EXPORT const CFStringRef kCFURLUbiquitousSharedItemReadOnlyPermissions /*CF_AVAILABLE(10_11, 9_0)*/; // the user is only allowed to read this item
+CF_EXPORT const CFStringRef kCFURLUbiquitousSharedItemReadWritePermissions /*CF_AVAILABLE(10_11, 9_0)*/; // the user is allowed to both read and write this item
+
+
 // these keys are defined here, not in CFURL.h, because they return NSImage values which can only be used by Foundation
 CF_EXPORT const CFStringRef kCFURLThumbnailDictionaryKey CF_AVAILABLE(10_10, 8_0);
 CF_EXPORT const CFStringRef kCFURLThumbnailKey CF_AVAILABLE(10_10, 8_0);
 // these keys are defined here, not in CFURL.h, because they return NSImage values which can only be used by Foundation
 CF_EXPORT const CFStringRef kCFURLThumbnailDictionaryKey CF_AVAILABLE(10_10, 8_0);
 CF_EXPORT const CFStringRef kCFURLThumbnailKey CF_AVAILABLE(10_10, 8_0);
index e5de170467bdc85f12cf3cd3791aa17a6df8e632..c573dbc19a1a08894c86adde5f081b2ff4468be7 100644 (file)
Binary files a/CFUniCharPropertyDatabase.data and b/CFUniCharPropertyDatabase.data differ
index af62f1d9ba9c7864f2c0133b2a0239f948f6a481..af5bdc7701111e8b31cff67585764d08d64976eb 100644 (file)
Binary files a/CFUnicodeData-B.mapping and b/CFUnicodeData-B.mapping differ
index e45d88567e6de7a47a3744bc2edf5a120e1fb8f1..8acb0d8c430f6db27bbcdb6963672956604dacac 100644 (file)
Binary files a/CFUnicodeData-L.mapping and b/CFUnicodeData-L.mapping differ
index 13faadd98c5eeab540959ac1d1158afc6cee9c05..d5751124c4a768214416a0ac9ed4686dd52b88b5 100644 (file)
@@ -25,5 +25,5 @@
     Copyright 2009-2014, Apple Inc. All rights reserved.
     Responsibility: CFLite Team
 */
     Copyright 2009-2014, Apple Inc. All rights reserved.
     Responsibility: CFLite Team
 */
-const unsigned char kCFCoreFoundationVersionString[] = "@(#)PROGRAM:CoreFoundation  PROJECT:CoreFoundation-1152  SYSTEM:Darwin  DEVELOPER:unknown  BUILT:" __DATE__ " " __TIME__ "\n";
-double kCFCoreFoundationVersionNumber = (double)1152;
+const unsigned char kCFCoreFoundationVersionString[] = "@(#)PROGRAM:CoreFoundation  PROJECT:CoreFoundation-1153.18  SYSTEM:Darwin  DEVELOPER:unknown  BUILT:" __DATE__ " " __TIME__ "\n";
+double kCFCoreFoundationVersionNumber = (double)1153.18;
index 670272013fb60dffb387dcadc1badada178da2a6..85cecda766e6ac79b5cabfb60ad9280feb870d50 100644 (file)
@@ -1 +1 @@
-VERSION=1152
+VERSION=1153.18