Skip to content

Reapply endianess fix in CFInternal.h that got overwrote by import fr… #934

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

Merged
merged 1 commit into from
Apr 11, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 15 additions & 18 deletions CoreFoundation/Base.subproj/CFInternal.h
Original file line number Diff line number Diff line change
Expand Up @@ -341,18 +341,24 @@ CF_EXPORT void * __CFConstantStringClassReferencePtr;

CF_EXPORT void *__CFConstantStringClassReference[];

#if __CF_BIG_ENDIAN__
#define CF_CONST_STRING_INFO {0x00, 0x00, 0x07, 0xc8}
#elif __CF_LITTLE_ENDIAN__
#define CF_CONST_STRING_INFO {0xc8, 0x07, 0x00, 0x00}
#endif

#if DEPLOYMENT_TARGET_LINUX
#define CONST_STRING_SECTION __attribute__((section(".cfstr.data")))
#else
#define CONST_STRING_SECTION
#endif

#define CONST_STRING_DECL(S, V) \
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}; \
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}; \
const CFStringRef S = (CFStringRef)&__##S;

#define PE_CONST_STRING_DECL(S, V) \
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}; \
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}; \
CF_PRIVATE const CFStringRef S = (CFStringRef)&__##S;


Expand All @@ -366,33 +372,24 @@ CF_PRIVATE const CFStringRef S = (CFStringRef)&__##S;
struct CF_CONST_STRING {
CFRuntimeBase _base;
uint8_t *_ptr;
uint32_t _length;
#if defined(__LP64__) && defined(__BIG_ENDIAN__)
uint64_t _length;
#else
uint32_t _length;
#endif
};

CF_EXPORT int __CFConstantStringClassReference[];

/* 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 */

#if __CF_BIG_ENDIAN__

#define CONST_STRING_DECL(S, V) \
static struct CF_CONST_STRING __ ## S ## __ = {{(uintptr_t)&__CFConstantStringClassReference, {0x00, 0x00, 0x07, 0xc8}}, (uint8_t *)V, sizeof(V) - 1}; \
static struct CF_CONST_STRING __ ## S ## __ = {{(uintptr_t)&__CFConstantStringClassReference, CF_CONST_STRING_INFO}, (uint8_t *)V, sizeof(V) - 1}; \
const CFStringRef S = (CFStringRef) & __ ## S ## __;
#define PE_CONST_STRING_DECL(S, V) \
static struct CF_CONST_STRING __ ## S ## __ = {{(uintptr_t)&__CFConstantStringClassReference, {0x00, 0x00, 0x07, 0xc8}}, (uint8_t *)V, sizeof(V) - 1}; \
static struct CF_CONST_STRING __ ## S ## __ = {{(uintptr_t)&__CFConstantStringClassReference, CF_CONST_STRING_INFO}, (uint8_t *)V, sizeof(V) - 1}; \
CF_PRIVATE const CFStringRef S = (CFStringRef) & __ ## S ## __;

#elif __CF_LITTLE_ENDIAN__

#define CONST_STRING_DECL(S, V) \
static struct CF_CONST_STRING __ ## S ## __ = {{(uintptr_t)&__CFConstantStringClassReference, {0xc8, 0x07, 0x00, 0x00}}, (uint8_t *)(V), sizeof(V) - 1}; \
const CFStringRef S = (CFStringRef) & __ ## S ## __;
#define PE_CONST_STRING_DECL(S, V) \
static struct CF_CONST_STRING __ ## S ## __ = {{(uintptr_t)&__CFConstantStringClassReference, {0xc8, 0x07, 0x00, 0x00}}, (uint8_t *)(V), sizeof(V) - 1}; \
CF_PRIVATE const CFStringRef S = (CFStringRef) & __ ## S ## __;

#endif

#endif // __CONSTANT_CFSTRINGS__

CF_EXPORT bool __CFOASafe;
Expand Down