Skip to content

Commit c341c94

Browse files
committed
Reapply endianess fix in CFInternal.h that got overwrote by import from Sierra
1 parent a7a902a commit c341c94

File tree

1 file changed

+15
-18
lines changed

1 file changed

+15
-18
lines changed

CoreFoundation/Base.subproj/CFInternal.h

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -341,18 +341,24 @@ CF_EXPORT void * __CFConstantStringClassReferencePtr;
341341

342342
CF_EXPORT void *__CFConstantStringClassReference[];
343343

344+
#if __CF_BIG_ENDIAN__
345+
#define CF_CONST_STRING_INFO {0x00, 0x00, 0x07, 0xc8}
346+
#elif __CF_LITTLE_ENDIAN__
347+
#define CF_CONST_STRING_INFO {0xc8, 0x07, 0x00, 0x00}
348+
#endif
349+
344350
#if DEPLOYMENT_TARGET_LINUX
345351
#define CONST_STRING_SECTION __attribute__((section(".cfstr.data")))
346352
#else
347353
#define CONST_STRING_SECTION
348354
#endif
349355

350356
#define CONST_STRING_DECL(S, V) \
351-
const struct __CFConstStr __##S CONST_STRING_SECTION = {{(uintptr_t)&__CFConstantStringClassReference, _CF_CONSTANT_OBJECT_STRONG_RC, 0, {0xc8, 0x07, 0x00, 0x00}}, (uint8_t *)(V), sizeof(V) - 1}; \
357+
const struct __CFConstStr __##S CONST_STRING_SECTION = {{(uintptr_t)&__CFConstantStringClassReference, _CF_CONSTANT_OBJECT_STRONG_RC, 0, CF_CONST_STRING_INFO}, (uint8_t *)(V), sizeof(V) - 1}; \
352358
const CFStringRef S = (CFStringRef)&__##S;
353359

354360
#define PE_CONST_STRING_DECL(S, V) \
355-
const static struct __CFConstStr __##S CONST_STRING_SECTION = {{(uintptr_t)&__CFConstantStringClassReference, _CF_CONSTANT_OBJECT_STRONG_RC, 0, {0xc8, 0x07, 0x00, 0x00}}, (uint8_t *)(V), sizeof(V) - 1}; \
361+
const static struct __CFConstStr __##S CONST_STRING_SECTION = {{(uintptr_t)&__CFConstantStringClassReference, _CF_CONSTANT_OBJECT_STRONG_RC, 0, CF_CONST_STRING_INFO}, (uint8_t *)(V), sizeof(V) - 1}; \
356362
CF_PRIVATE const CFStringRef S = (CFStringRef)&__##S;
357363

358364

@@ -366,33 +372,24 @@ CF_PRIVATE const CFStringRef S = (CFStringRef)&__##S;
366372
struct CF_CONST_STRING {
367373
CFRuntimeBase _base;
368374
uint8_t *_ptr;
369-
uint32_t _length;
375+
#if defined(__LP64__) && defined(__BIG_ENDIAN__)
376+
uint64_t _length;
377+
#else
378+
uint32_t _length;
379+
#endif
370380
};
371381

372382
CF_EXPORT int __CFConstantStringClassReference[];
373383

374384
/* CFNetwork also has a copy of the CONST_STRING_DECL macro (for use on platforms without constant string support in cc); please warn cfnetwork-core@group.apple.com of any necessary changes to this macro. -- REW, 1/28/2002 */
375385

376-
#if __CF_BIG_ENDIAN__
377-
378386
#define CONST_STRING_DECL(S, V) \
379-
static struct CF_CONST_STRING __ ## S ## __ = {{(uintptr_t)&__CFConstantStringClassReference, {0x00, 0x00, 0x07, 0xc8}}, (uint8_t *)V, sizeof(V) - 1}; \
387+
static struct CF_CONST_STRING __ ## S ## __ = {{(uintptr_t)&__CFConstantStringClassReference, CF_CONST_STRING_INFO}, (uint8_t *)V, sizeof(V) - 1}; \
380388
const CFStringRef S = (CFStringRef) & __ ## S ## __;
381389
#define PE_CONST_STRING_DECL(S, V) \
382-
static struct CF_CONST_STRING __ ## S ## __ = {{(uintptr_t)&__CFConstantStringClassReference, {0x00, 0x00, 0x07, 0xc8}}, (uint8_t *)V, sizeof(V) - 1}; \
390+
static struct CF_CONST_STRING __ ## S ## __ = {{(uintptr_t)&__CFConstantStringClassReference, CF_CONST_STRING_INFO}, (uint8_t *)V, sizeof(V) - 1}; \
383391
CF_PRIVATE const CFStringRef S = (CFStringRef) & __ ## S ## __;
384392

385-
#elif __CF_LITTLE_ENDIAN__
386-
387-
#define CONST_STRING_DECL(S, V) \
388-
static struct CF_CONST_STRING __ ## S ## __ = {{(uintptr_t)&__CFConstantStringClassReference, {0xc8, 0x07, 0x00, 0x00}}, (uint8_t *)(V), sizeof(V) - 1}; \
389-
const CFStringRef S = (CFStringRef) & __ ## S ## __;
390-
#define PE_CONST_STRING_DECL(S, V) \
391-
static struct CF_CONST_STRING __ ## S ## __ = {{(uintptr_t)&__CFConstantStringClassReference, {0xc8, 0x07, 0x00, 0x00}}, (uint8_t *)(V), sizeof(V) - 1}; \
392-
CF_PRIVATE const CFStringRef S = (CFStringRef) & __ ## S ## __;
393-
394-
#endif
395-
396393
#endif // __CONSTANT_CFSTRINGS__
397394

398395
CF_EXPORT bool __CFOASafe;

0 commit comments

Comments
 (0)