minimum changes to complie it with clang

This commit is contained in:
Glenn Ganz 2011-05-19 10:47:55 +02:00
parent 6bf983b47a
commit 8c9bd80c44
11 changed files with 1608 additions and 38 deletions

View File

@ -96,7 +96,7 @@ CFAbsoluteTime CFRunLoopGetNextTimerFireDate(CFRunLoopRef self,CFStringRef mode)
}
CFInteger CFRunLoopRunInMode(CFStringRef mode,CFTimeInterval seconds,Boolean returnAfterSourceHandled) {
CFRunLoopRef runLoop=CFRunLoopGetCurrent();
NSRunLoop *runLoop=(NSRunLoop*)CFRunLoopGetCurrent();
NSDate *before=[NSDate dateWithTimeIntervalSinceNow:seconds];
[runLoop->_continue addObject:[NSNumber numberWithBool:YES]];
@ -120,8 +120,9 @@ CFInteger CFRunLoopRunInMode(CFStringRef mode,CFTimeInterval seconds,Boolean ret
}
void CFRunLoopStop(CFRunLoopRef self) {
[self->_continue removeLastObject];
[self->_continue addObject:[NSNumber numberWithBool:NO]];
NSRunLoop *runLoop=(NSRunLoop*)self;
[runLoop->_continue removeLastObject];
[runLoop->_continue addObject:[NSNumber numberWithBool:NO]];
}
void CFRunLoopWakeUp(CFRunLoopRef self) {

View File

@ -110,27 +110,27 @@ CFUUIDRef CFUUIDGetConstantUUIDWithBytes(CFAllocatorRef allocator,uint8_t byte0,
}
CFUUIDBytes CFUUIDGetUUIDBytes(CFUUIDRef self){
return self->_bytes;
return ((CFUUID *)self)->_bytes;
}
CFStringRef CFUUIDCreateString(CFAllocatorRef allocator,CFUUIDRef self){
return (CFStringRef)[[NSString alloc] initWithFormat:@"%02X%02X%02X%02X-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X%02X%02X",
self->_bytes.byte0,
self->_bytes.byte1,
self->_bytes.byte2,
self->_bytes.byte3,
self->_bytes.byte4,
self->_bytes.byte5,
self->_bytes.byte6,
self->_bytes.byte7,
self->_bytes.byte8,
self->_bytes.byte9,
self->_bytes.byte10,
self->_bytes.byte11,
self->_bytes.byte12,
self->_bytes.byte13,
self->_bytes.byte14,
self->_bytes.byte15];
((CFUUID *)self)->_bytes.byte0,
((CFUUID *)self)->_bytes.byte1,
((CFUUID *)self)->_bytes.byte2,
((CFUUID *)self)->_bytes.byte3,
((CFUUID *)self)->_bytes.byte4,
((CFUUID *)self)->_bytes.byte5,
((CFUUID *)self)->_bytes.byte6,
((CFUUID *)self)->_bytes.byte7,
((CFUUID *)self)->_bytes.byte8,
((CFUUID *)self)->_bytes.byte9,
((CFUUID *)self)->_bytes.byte10,
((CFUUID *)self)->_bytes.byte11,
((CFUUID *)self)->_bytes.byte12,
((CFUUID *)self)->_bytes.byte13,
((CFUUID *)self)->_bytes.byte14,
((CFUUID *)self)->_bytes.byte15];
}
@end

File diff suppressed because it is too large Load Diff

View File

@ -20,7 +20,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
#import <Foundation/NSPlatform.h>
#import <objc/runtime.h>
#import <Foundation/NSRaiseException.h>
#ifdef __APPLE__
#if defined(__APPLE__) && !defined(__clang__)
#import"OBJCRegisterModule_Darwin.h"
#endif
@ -140,7 +140,7 @@ NSModuleHandle NSLoadModule(const char *path) {
if (handle == NULL){
NSCLog(NSLastModuleError());
}
#ifdef __APPLE__
#if defined(__APPLE__) && !defined(__clang__)
OBJCRegisterModule_Darwin(path);
#endif

View File

@ -421,16 +421,20 @@ static void byteCopy(void *src,void *dst,NSUInteger length){
}
else {
struct structReturn {
char result[size];
char *result;
} (*function)()=(struct structReturn (*)())msgSendv; // should be msgSend_stret
struct structReturn value;
// FIX internal compiler error on windows/linux/bsd
value.result = calloc(size, sizeof(char));
// FIX internal compiler error on windows/linux/bsd
#if !defined(WIN32) && !defined(BSD) && !defined(LINUX)
value=function(target,[self selector],_argumentFrameSize,_argumentFrame);
#endif
[self setReturnValue:&value];
free(value.result);
}
}
break;

View File

@ -8,7 +8,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
#import <Foundation/NSNumber_BOOL.h>
#import <Foundation/NSStringFormatter.h>
#if __APPLE__
#if defined(__APPLE__) && !defined(__clang__)
#import <Foundation/NSNumber_BOOL_const.h>
#else
#import <Foundation/NSNumber_BOOL_const_impl.h>

View File

@ -7,6 +7,6 @@
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#if __APPLE__
#if defined(__APPLE__) && !defined(__clang__)
#import <Foundation/NSNumber_BOOL_const_impl.h>
#endif

View File

@ -75,8 +75,9 @@ void NSLogv(NSString *format,va_list arguments) {
bytes=NSString_cStringFromCharacters(unicode,length,YES,&byteLength,NULL,NO);
[string release];
if (bytes == NULL) return;
#ifndef __clang__
assert(sNSLogCString != NULL);
#endif
sNSLogCString(bytes,byteLength,YES);
NSZoneFree(NULL,bytes);
}

View File

@ -115,8 +115,9 @@ static uint64_t ReadSizedInt(NSPropertyListReader_binary1 *bplist, uint64_t offs
{
const uint8_t *ptr = bplist->_bytes;
NSUInteger length=bplist->_length;
#ifndef __clang__
assert(ptr != NULL && size >= 1 && size <= 8 && offset + size <= length);
#endif
uint64_t result = 0;
const uint8_t *byte = ptr + offset;
@ -136,8 +137,9 @@ static BOOL ReadSelfSizedInt(NSPropertyListReader_binary1 *bplist, uint64_t offs
uint32_t size;
int64_t value;
#ifndef __clang__
assert(ptr != NULL && offset < length);
#endif
size = 1 << (ptr[offset] & 0x0F);
if (size > 8)

View File

@ -12,7 +12,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
#import "ObjCException.h"
#import "objc_malloc.h"
#import "objc_protocol.h"
#ifdef __APPLE__
#if defined(__APPLE__) && !defined(__clang__)
#import "OBJCRegisterModule_Darwin.h"
#endif
@ -194,7 +194,7 @@ int _NSGetExecutablePath(char *path,uint32_t *capacity) {
#endif
void OBJCInitializeProcess() {
#ifdef __APPLE__
#if defined(__APPLE__) && !defined(__clang__)
OBJCRegisterModule_Darwin(NULL);
#endif

View File

@ -10,6 +10,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
#import <objc/objc.h>
#import "objc_sel.h"
#import <objc/runtime.h>
#import <objc/message.h>
enum {
CLASS_INFO_CLASS=0x001,