mirror of
https://github.com/darlinghq/darling-cocotron.git
synced 2024-11-23 12:09:51 +00:00
fix cast warnings with clang
This commit is contained in:
parent
197a5af187
commit
7291167d1e
@ -28,6 +28,7 @@ typedef void (*O2DataProviderReleaseDataCallback)(void *info,const void *data,si
|
||||
}
|
||||
|
||||
-initWithURL:(NSURL *)url;
|
||||
-initWithBytes:(const void *)bytes length:(size_t)length;
|
||||
|
||||
O2DataProviderRef O2DataProviderCreateWithData(void *info,const void *data,size_t size,O2DataProviderReleaseDataCallback releaseCallback);
|
||||
O2DataProviderRef O2DataProviderCreateWithCFData(CFDataRef data);
|
||||
|
@ -111,6 +111,7 @@ enum {
|
||||
}
|
||||
|
||||
-initWithContentsOfFile:(NSString *)path;
|
||||
-initWithData:(NSData *)data;
|
||||
|
||||
-(NSData *)data;
|
||||
|
||||
|
@ -90,6 +90,6 @@ NSString *O2FontCopyGlyphNameForGlyph(O2FontRef self,O2Glyph glyph);
|
||||
|
||||
NSData *O2FontCopyTableForTag(O2FontRef self,uint32_t tag);
|
||||
|
||||
uint16_t O2FontUnicodeForGlyphName(NSString *name);
|
||||
uint16_t O2FontUnicodeForGlyphName(CFStringRef name);
|
||||
|
||||
@end
|
||||
|
@ -457,7 +457,7 @@ NSData *O2FontCopyTableForTag(O2FontRef self,uint32_t tag) {
|
||||
return [self copyTableForTag:(uint32_t)tag];
|
||||
}
|
||||
|
||||
uint16_t O2FontUnicodeForGlyphName(NSString *name){
|
||||
uint16_t O2FontUnicodeForGlyphName(CFStringRef name){
|
||||
struct {
|
||||
NSString *name;
|
||||
unichar code;
|
||||
@ -4770,7 +4770,7 @@ uint16_t O2FontUnicodeForGlyphName(NSString *name){
|
||||
int i;
|
||||
|
||||
for(i=0;entries[i].name!=nil;i++)
|
||||
if([entries[i].name isEqualToString:name])
|
||||
if([entries[i].name isEqualToString:(NSString *)name])
|
||||
return entries[i].code;
|
||||
|
||||
NSLog(@"%s %d unable to map glyph name %@",__FILE__,__LINE__,name);
|
||||
|
@ -187,8 +187,8 @@ static inline O2TextEncoding textEncodingWithName(const char *name){
|
||||
else if([check checkForType:kO2PDFObjectTypeName value:&name]){
|
||||
NSString *string=[[NSString alloc] initWithCString:name];
|
||||
|
||||
O2Glyph glyph=O2FontGetGlyphWithGlyphName(_graphicsFont,string);
|
||||
uint16_t unicode=O2FontUnicodeForGlyphName(string);
|
||||
O2Glyph glyph=O2FontGetGlyphWithGlyphName(_graphicsFont,(CFStringRef)string);
|
||||
uint16_t unicode=O2FontUnicodeForGlyphName((CFStringRef)string);
|
||||
|
||||
[newEncoding setGlyph:glyph unicode:unicode atIndex:currentIndex];
|
||||
|
||||
|
@ -1137,7 +1137,7 @@ void O2PDF_render_Tj(O2PDFScanner *scanner,void *info) {
|
||||
return;
|
||||
}
|
||||
|
||||
O2ContextShowText(context,O2PDFStringGetBytePtr(string),O2PDFStringGetLength(string));
|
||||
O2ContextShowText(context,(const char *)O2PDFStringGetBytePtr(string),O2PDFStringGetLength(string));
|
||||
}
|
||||
|
||||
// Show text, alowing individual glyph positioning
|
||||
@ -1169,7 +1169,7 @@ void O2PDF_render_TJ(O2PDFScanner *scanner,void *info) {
|
||||
O2ContextSetTextMatrix(context,Tm);
|
||||
}
|
||||
else if([object checkForType:kO2PDFObjectTypeString value:&string]){
|
||||
O2ContextShowText(context,O2PDFStringGetBytePtr(string),O2PDFStringGetLength(string));
|
||||
O2ContextShowText(context,(const char *)O2PDFStringGetBytePtr(string),O2PDFStringGetLength(string));
|
||||
}
|
||||
else {
|
||||
O2PDFFix(__FILE__,__LINE__,@"Invalid object in TJ array");
|
||||
@ -1352,7 +1352,7 @@ void O2PDF_render_dquote(O2PDFScanner *scanner,void *info) {
|
||||
O2ContextSetWordSpacing(context,wspacing);
|
||||
O2ContextSetCharacterSpacing(context,cspacing);
|
||||
O2PDF_render_T_star(scanner,info);
|
||||
O2ContextShowText(context,O2PDFStringGetBytePtr(string),O2PDFStringGetLength(string));
|
||||
O2ContextShowText(context,(const char *)O2PDFStringGetBytePtr(string),O2PDFStringGetLength(string));
|
||||
}
|
||||
|
||||
void O2PDF_render_populateOperatorTable(O2PDFOperatorTable *table) {
|
||||
|
@ -285,7 +285,7 @@ BOOL O2PDFScanVersion(const char *bytes,unsigned length,O2PDFString **versionp)
|
||||
if(strncmp(bytes,"%PDF-",5)!=0)
|
||||
return debugError(bytes,length,0,@"Does not begin with %%PDF-");
|
||||
|
||||
*versionp=[O2PDFString pdfObjectWithBytes:bytes+5 length:3];
|
||||
*versionp=[O2PDFString pdfObjectWithBytes:(const unsigned char *)bytes+5 length:3];
|
||||
|
||||
position=length;
|
||||
|
||||
@ -443,7 +443,7 @@ BOOL O2PDFScanObject(const char *bytes,unsigned length,O2PDFInteger position,O2P
|
||||
|
||||
case STATE_STRING_NOFREE:
|
||||
if(code==')'){
|
||||
*objectp=[O2PDFString pdfObjectWithBytesNoCopyNoFree:bytes+inlineLocation length:position-inlineLocation];
|
||||
*objectp=[O2PDFString pdfObjectWithBytesNoCopyNoFree:(const unsigned char *)bytes+inlineLocation length:position-inlineLocation];
|
||||
*lastPosition=position+1;
|
||||
return YES;
|
||||
}
|
||||
|
@ -15,16 +15,16 @@ typedef O2PDFString *O2PDFStringRef;
|
||||
@interface O2PDFString : O2PDFObject {
|
||||
unsigned _length:31;
|
||||
unsigned _noCopyNoFree:1;
|
||||
char *_bytes;
|
||||
unsigned char *_bytes;
|
||||
}
|
||||
|
||||
+pdfObjectWithBytes:(const char *)bytes length:(unsigned)length;
|
||||
+pdfObjectWithBytesNoCopyNoFree:(const char *)bytes length:(unsigned)length;
|
||||
+pdfObjectWithBytes:(const unsigned char *)bytes length:(unsigned)length;
|
||||
+pdfObjectWithBytesNoCopyNoFree:(const unsigned char *)bytes length:(unsigned)length;
|
||||
+pdfObjectWithCString:(const char *)cString;
|
||||
+pdfObjectWithString:(NSString *)string;
|
||||
|
||||
-(unsigned)length;
|
||||
-(const char *)bytes;
|
||||
-(const unsigned char *)bytes;
|
||||
|
||||
size_t O2PDFStringGetLength(O2PDFStringRef string);
|
||||
const unsigned char *O2PDFStringGetBytePtr(O2PDFStringRef string);
|
||||
|
@ -13,18 +13,18 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
|
||||
@implementation O2PDFString
|
||||
|
||||
-initWithBytes:(const char *)bytes length:(unsigned)length {
|
||||
-initWithBytes:(const unsigned char *)bytes length:(unsigned)length {
|
||||
_length=length;
|
||||
_noCopyNoFree=NO;
|
||||
_bytes=NSZoneMalloc(NULL,length);
|
||||
strncpy(_bytes,bytes,length);
|
||||
strncpy((char *)_bytes,(const char *)bytes,length);
|
||||
return self;
|
||||
}
|
||||
|
||||
-initWithBytesNoCopyNoFree:(const char *)bytes length:(unsigned)length {
|
||||
-initWithBytesNoCopyNoFree:(const unsigned char *)bytes length:(unsigned)length {
|
||||
_length=length;
|
||||
_noCopyNoFree=YES;
|
||||
_bytes=(char *)bytes;
|
||||
_bytes=(unsigned char *)bytes;
|
||||
return self;
|
||||
}
|
||||
|
||||
@ -34,16 +34,16 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
+pdfObjectWithBytes:(const char *)bytes length:(unsigned)length {
|
||||
+pdfObjectWithBytes:(const unsigned char *)bytes length:(unsigned)length {
|
||||
return [[(O2PDFString *)[self alloc] initWithBytes:bytes length:length] autorelease];
|
||||
}
|
||||
|
||||
+pdfObjectWithBytesNoCopyNoFree:(const char *)bytes length:(unsigned)length {
|
||||
+pdfObjectWithBytesNoCopyNoFree:(const unsigned char *)bytes length:(unsigned)length {
|
||||
return [[(O2PDFString *)[self alloc] initWithBytesNoCopyNoFree:bytes length:length] autorelease];
|
||||
}
|
||||
|
||||
+pdfObjectWithCString:(const char *)cString {
|
||||
return [[(O2PDFString *)[self alloc] initWithBytes:cString length:strlen(cString)] autorelease];
|
||||
return [[(O2PDFString *)[self alloc] initWithBytes:(const unsigned char *)cString length:strlen(cString)] autorelease];
|
||||
}
|
||||
|
||||
+pdfObjectWithString:(NSString *)string {
|
||||
@ -68,7 +68,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
return _length;
|
||||
}
|
||||
|
||||
-(const char *)bytes {
|
||||
-(const unsigned char *)bytes {
|
||||
return _bytes;
|
||||
}
|
||||
|
||||
@ -88,7 +88,7 @@ const unsigned char *O2PDFStringGetBytePtr(O2PDFStringRef string) {
|
||||
-(NSString *)description {
|
||||
char s[_length+1];
|
||||
|
||||
strncpy(s,_bytes,_length);
|
||||
strncpy(s,(const char *)_bytes,_length);
|
||||
s[_length]='\0';
|
||||
return [NSString stringWithFormat:@"<%@ %s>",isa,s];
|
||||
}
|
||||
|
@ -735,7 +735,7 @@ void O2TTFDecoderGetNameTable(O2TTFDecoderRef self) {
|
||||
|
||||
for(i=0;i<count;i++){
|
||||
uint16_t platformID=decode_uint16(self);
|
||||
uint16_t platformSpecificID=decode_uint16(self);
|
||||
/*uint16_t platformSpecificID=*/decode_uint16(self);
|
||||
uint16_t languageID=decode_uint16(self);
|
||||
uint16_t nameID=decode_uint16(self);
|
||||
uint16_t length=decode_uint16(self);
|
||||
@ -747,7 +747,7 @@ void O2TTFDecoderGetNameTable(O2TTFDecoderRef self) {
|
||||
|
||||
NSLog(@"position=%ld,stringOffset=%d,offset=%d",self->_position,stringOffset,offset);
|
||||
|
||||
NSString *string=[NSString stringWithCString:self->_bytes+location length:length];
|
||||
NSString *string=[NSString stringWithCString:(const char *)self->_bytes+location length:length];
|
||||
|
||||
NSLog(@"platformID=%d,languageID=%d,string=%@",platformID,languageID,string);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user