From aab9497a4766f2538efdeaef98bbd6fa1d4eb4ae Mon Sep 17 00:00:00 2001 From: Christopher Lloyd Date: Tue, 3 May 2011 11:08:30 -0400 Subject: [PATCH] clean up some warnings, NSSearchPathForDirectoriesInDomains fixes --- AppKit/Win32.subproj/CGLContext.m | 15 +++++---------- CoreData/NSManagedObjectContext.m | 2 +- CoreData/NSPersistentStoreCoordinator.m | 2 +- CoreData/NSXMLPersistentStore.m | 4 +++- CoreFoundation/CFBase.m | 4 ++-- CoreFoundation/CFNumber.m | 6 +++++- Foundation/NSString/NSPathUtilities.m | 15 +++++++++++---- Foundation/xml/NSXMLParser.m | 1 + Onyx2D/O2Paint_image.m | 2 ++ Onyx2D/O2TTFDecoder.m | 2 ++ Onyx2D/VGPath.m | 3 ++- Onyx2D/platform_Windows/O2Context_builtin_gdi.m | 2 +- QuartzCore/CALayerContext.m | 2 +- QuartzCore/CARenderer.m | 4 ++++ 14 files changed, 41 insertions(+), 23 deletions(-) diff --git a/AppKit/Win32.subproj/CGLContext.m b/AppKit/Win32.subproj/CGLContext.m index 74e40406..562edb1f 100644 --- a/AppKit/Win32.subproj/CGLContext.m +++ b/AppKit/Win32.subproj/CGLContext.m @@ -224,6 +224,9 @@ static BOOL contextHasMakeCurrentReadExtension(CGLContextObj context){ } #endif +static void _CGLCreateDynamicPbufferBacking(CGLContextObj context); +static void _CGLDestroyDynamicPbufferBacking(CGLContextObj context); + static void resizeBackingIfNeeded(CGLContextObj context){ if(!context->resizeBacking) return; @@ -399,14 +402,6 @@ static BOOL contextHasPbufferExtension(CGLContextObj context){ return YES; } -static int powerOfTwo(int value){ - int result=1; - - while(resultwindowDC,context->windowGLContext); reportGLErrorIfNeeded(__PRETTY_FUNCTION__,__LINE__); @@ -531,7 +526,7 @@ void _CGLDestroyStaticPbufferBacking(CGLContextObj context){ context->staticPbufferDC=NULL; } -void _CGLDestroyDynamicPbufferBacking(CGLContextObj context){ +static void _CGLDestroyDynamicPbufferBacking(CGLContextObj context){ // Window context must be current for pBuffer functions to work. opengl_wglMakeCurrent(context->windowDC,context->windowGLContext); diff --git a/CoreData/NSManagedObjectContext.m b/CoreData/NSManagedObjectContext.m index f5e2a99b..f85b7710 100644 --- a/CoreData/NSManagedObjectContext.m +++ b/CoreData/NSManagedObjectContext.m @@ -205,7 +205,7 @@ NSString * const NSInvalidatedAllObjectsKey=@"NSInvalidatedAllObjectsKey"; } -(NSAtomicStoreCacheNode *)_cacheNodeForObjectID:(NSManagedObjectID *)objectID { - NSAtomicStore *store=[_storeCoordinator _persistentStoreForObjectID:objectID]; + NSAtomicStore *store=(NSAtomicStore *)[_storeCoordinator _persistentStoreForObjectID:objectID]; return [store cacheNodeForObjectID:objectID]; } diff --git a/CoreData/NSPersistentStoreCoordinator.m b/CoreData/NSPersistentStoreCoordinator.m index 448d7c6a..47dbe5b8 100644 --- a/CoreData/NSPersistentStoreCoordinator.m +++ b/CoreData/NSPersistentStoreCoordinator.m @@ -210,7 +210,7 @@ static NSMutableDictionary *_storeTypes=nil; NSManagedObjectModel *model=[self managedObjectModel]; NSEntityDescription *entity=[[model entitiesByName] objectForKey:entityName]; - return [[self _persistentStoreWithIdentifier:host] objectIDForEntity:entity referenceObject:referenceObject]; + return [(NSAtomicStore *)[self _persistentStoreWithIdentifier:host] objectIDForEntity:entity referenceObject:referenceObject]; } @end diff --git a/CoreData/NSXMLPersistentStore.m b/CoreData/NSXMLPersistentStore.m index 8435c50d..905e8a97 100644 --- a/CoreData/NSXMLPersistentStore.m +++ b/CoreData/NSXMLPersistentStore.m @@ -214,7 +214,9 @@ break; case NSDateAttributeType: - objectValue=[NSCalendarDate dateWithNaturalLanguageString:stringValue]; + objectValue=nil; + // we don't want to use NSCalendarDate + // objectValue=[NSCalendarDate dateWithNaturalLanguageString:stringValue]; break; case NSBinaryDataAttributeType: diff --git a/CoreFoundation/CFBase.m b/CoreFoundation/CFBase.m index 01cbf8a6..193880ac 100644 --- a/CoreFoundation/CFBase.m +++ b/CoreFoundation/CFBase.m @@ -156,13 +156,13 @@ size_t strlcpy(char *dst, const char *src, size_t size) { char *strnstr(const char *s1,const char *s2, size_t n) { if(s2[0]=='\0') - return s1; + return (char *)s1; size_t i,patLength=strlen(s2); for(i=0;s1[i]!='\0' && i+patLength<=n;i++) if(strncmp(s1+i,s2,patLength)==0) - return s1+i; + return (char *)(s1+i); return NULL; } diff --git a/CoreFoundation/CFNumber.m b/CoreFoundation/CFNumber.m index 3bb8163e..536abeb8 100644 --- a/CoreFoundation/CFNumber.m +++ b/CoreFoundation/CFNumber.m @@ -8,12 +8,14 @@ struct __CFBoolean { #define ToNSNumber(object) ((NSNumber *)object) +@implementation NSNumber_CF(CF) + CFTypeID CFBooleanGetTypeID(void) { return kNSCFTypeBoolean; } CFNumberType CFNumberGetType(CFNumberRef self) { - if([self isKindOfClass:[NSNumber_CF class]]) + if([ToNSNumber(self) isKindOfClass:[NSNumber_CF class]]) return ((NSNumber_CF *)self)->_type; return kCFNumberIntType; @@ -22,3 +24,5 @@ CFNumberType CFNumberGetType(CFNumberRef self) { Boolean CFBooleanGetValue(CFBooleanRef self) { return [ToNSNumber(self) boolValue]; } + +@end diff --git a/Foundation/NSString/NSPathUtilities.m b/Foundation/NSString/NSPathUtilities.m index 63a8014e..b655e611 100755 --- a/Foundation/NSString/NSPathUtilities.m +++ b/Foundation/NSString/NSPathUtilities.m @@ -289,16 +289,23 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI NSArray *NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory directory,NSSearchPathDomainMask mask,BOOL expand) { if(mask!=NSUserDomainMask) NSUnimplementedFunction(); - + +/* Callers expect the directories to exist, so create them if needed. + */ + if(directory==NSCachesDirectory){ - NSString *path=[[[NSHomeDirectory() stringByAppendingPathComponent:@"Library"] stringByAppendingPathComponent:@"Caches"] stringByAppendingPathComponent:[[NSProcessInfo processInfo] processName]]; + NSString *path=[[NSHomeDirectory() stringByAppendingPathComponent:@"Library"] stringByAppendingPathComponent:@"Caches"]; + + [[NSFileManager defaultManager] createDirectoryAtPath:path withIntermediateDirectories:YES attributes:nil]; return [NSArray arrayWithObject:path]; } if(directory==NSApplicationSupportDirectory){ - NSString *path=[[[NSHomeDirectory() stringByAppendingPathComponent:@"Library"] stringByAppendingPathComponent:@"Application Support"] stringByAppendingPathComponent:[[NSProcessInfo processInfo] processName]]; - + NSString *path=[[NSHomeDirectory() stringByAppendingPathComponent:@"Library"] stringByAppendingPathComponent:@"Application Support"]; + + [[NSFileManager defaultManager] createDirectoryAtPath:path withIntermediateDirectories:YES attributes:nil]; + return [NSArray arrayWithObject:path]; } diff --git a/Foundation/xml/NSXMLParser.m b/Foundation/xml/NSXMLParser.m index dd8d1c2d..2e52d883 100644 --- a/Foundation/xml/NSXMLParser.m +++ b/Foundation/xml/NSXMLParser.m @@ -12,6 +12,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI #import #import #import +#import enum { STATE_content, diff --git a/Onyx2D/O2Paint_image.m b/Onyx2D/O2Paint_image.m index 0b24f407..bcdc2b90 100644 --- a/Onyx2D/O2Paint_image.m +++ b/Onyx2D/O2Paint_image.m @@ -29,12 +29,14 @@ @implementation O2Paint_image +#if 0 ONYX2D_STATIC int O2PaintReadResampledHighSpan_largb32f_PRE(O2Paint *selfX,int x,int y,O2argb32f *span,int length){ O2Paint_image *self=(O2Paint_image *)selfX; O2ImageBicubic_largb32f_PRE(self->_image,x,y,span,length,self->m_surfaceToPaintMatrix); return length; } +#endif ONYX2D_STATIC int O2PaintReadResampledLowSpan_largb32f_PRE(O2Paint *selfX,int x,int y,O2argb32f *span,int length){ O2Paint_image *self=(O2Paint_image *)selfX; diff --git a/Onyx2D/O2TTFDecoder.m b/Onyx2D/O2TTFDecoder.m index 6bd94c45..b96c5617 100644 --- a/Onyx2D/O2TTFDecoder.m +++ b/Onyx2D/O2TTFDecoder.m @@ -40,6 +40,7 @@ static void dump(O2TTFDecoderRef self,NSString *format,...){ } } +#if 0 static CFIndex currentPosition(O2TTFDecoderRef self){ return self->_position; } @@ -47,6 +48,7 @@ static CFIndex currentPosition(O2TTFDecoderRef self){ static void seekToPosition(O2TTFDecoderRef self,CFIndex value){ self->_position=value; } +#endif static uint8_t decode_uint8(O2TTFDecoderRef self){ if(self->_position>=self->_length){ diff --git a/Onyx2D/VGPath.m b/Onyx2D/VGPath.m index c03cc3a9..c8328791 100644 --- a/Onyx2D/VGPath.m +++ b/Onyx2D/VGPath.m @@ -1161,7 +1161,7 @@ BOOL VGPathAddQuadTo(VGPath *self,O2Point p0, O2Point p1, O2Point p2, BOOL subpa } // Tessellates a cubic-to segment. - +#if 0 // Bezier to lines from: Windows Graphics Programming by Feng Yuan static void bezier(VGPath *self,double x1,double y1,double x2, double y2,double x3,double y3,double x4,double y4,unsigned *prevFlags,O2Point *pp,O2Point *tp){ // Ax+By+C=0 is the line (x1,y1) (x4,y4); @@ -1199,6 +1199,7 @@ static void bezier(VGPath *self,double x1,double y1,double x2, double y2,double bezier(self,x/8,y/8,x2334/4,y2334/4,x34/2,y34/2,x4,y4,prevFlags,pp,tp); } } +#endif BOOL VGPathAddCubicTo(VGPath *self,O2Point p0, O2Point p1, O2Point p2, O2Point p3, BOOL subpathHasGeometry){ if(Vector2IsEqual(p0,p1) && Vector2IsEqual(p0,p2) && Vector2IsEqual(p0 ,p3)) diff --git a/Onyx2D/platform_Windows/O2Context_builtin_gdi.m b/Onyx2D/platform_Windows/O2Context_builtin_gdi.m index b4dce7df..be6aa718 100644 --- a/Onyx2D/platform_Windows/O2Context_builtin_gdi.m +++ b/Onyx2D/platform_Windows/O2Context_builtin_gdi.m @@ -161,6 +161,7 @@ static void applyCoverageToSpan_lRGBA8888_PRE(O2argb8u *dst,uint8_t *coverageSpa } } +#if 0 static void drawGray8Stencil(O2Context_builtin_gdi *self,O2Surface *surface,CGFloat fpx,CGFloat fpy,O2Paint *paint,uint8_t *coverage,size_t bytesPerRow,size_t width,size_t height,int left,int top){ int x=lroundf(fpx)+left; int y=lroundf(fpy)-top; @@ -231,7 +232,6 @@ static void drawGray8Stencil(O2Context_builtin_gdi *self,O2Surface *surface,CGFl } -#if 0 static void drawFreeTypeBitmap(O2Context_builtin_gdi *self,O2Surface *surface,O2GlyphStencilRef stencil,CGFloat fpx,CGFloat fpy,O2Paint *paint){ drawGray8Stencil(self,surface,fpx,fpy,paint,O2GlyphStencilGetCoverage(stencil),O2GlyphStencilGetWidth(stencil),O2GlyphStencilGetWidth(stencil),O2GlyphStencilGetHeight(stencil),O2GlyphStencilGetLeft(stencil),O2GlyphStencilGetTop(stencil)); } diff --git a/QuartzCore/CALayerContext.m b/QuartzCore/CALayerContext.m index 1101f696..9539362e 100644 --- a/QuartzCore/CALayerContext.m +++ b/QuartzCore/CALayerContext.m @@ -116,7 +116,7 @@ [_renderer render]; - [pixelSurface flushBuffer]; + [pixelSurface readBuffer]; } -(void)render { diff --git a/QuartzCore/CARenderer.m b/QuartzCore/CARenderer.m index 1b8ec0ce..c712179b 100644 --- a/QuartzCore/CARenderer.m +++ b/QuartzCore/CARenderer.m @@ -6,6 +6,10 @@ #import #import +@interface CALayer(private) +-(NSNumber *)_textureId; +@end + @implementation CARenderer -(CGRect)bounds {