Skip to content

Commit

Permalink
clean up some warnings, NSSearchPathForDirectoriesInDomains fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
cjwl committed May 3, 2011
1 parent fafa3fc commit aab9497
Show file tree
Hide file tree
Showing 14 changed files with 41 additions and 23 deletions.
15 changes: 5 additions & 10 deletions AppKit/Win32.subproj/CGLContext.m
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -399,14 +402,6 @@ static BOOL contextHasPbufferExtension(CGLContextObj context){
return YES;
}

static int powerOfTwo(int value){
int result=1;

while(result<value)
result*=2;

return result;
}

void _CGLCreateDynamicPbufferBacking(CGLContextObj context){

Expand Down Expand Up @@ -507,7 +502,7 @@ void _CGLCreateBufferBackingIfPossible(CGLContextObj context){
CGLSetCurrentContext(saveContext);
}

void _CGLDestroyStaticPbufferBacking(CGLContextObj context){
static void _CGLDestroyStaticPbufferBacking(CGLContextObj context){
// Window context must be current for pBuffer functions to work.
opengl_wglMakeCurrent(context->windowDC,context->windowGLContext);
reportGLErrorIfNeeded(__PRETTY_FUNCTION__,__LINE__);
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion CoreData/NSManagedObjectContext.m
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ -(void)rollback {
}

-(NSAtomicStoreCacheNode *)_cacheNodeForObjectID:(NSManagedObjectID *)objectID {
NSAtomicStore *store=[_storeCoordinator _persistentStoreForObjectID:objectID];
NSAtomicStore *store=(NSAtomicStore *)[_storeCoordinator _persistentStoreForObjectID:objectID];

return [store cacheNodeForObjectID:objectID];
}
Expand Down
2 changes: 1 addition & 1 deletion CoreData/NSPersistentStoreCoordinator.m
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ -(NSManagedObjectID *)managedObjectIDForURIRepresentation:(NSURL *)URL {
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
4 changes: 3 additions & 1 deletion CoreData/NSXMLPersistentStore.m
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,9 @@ -(NSAtomicStoreCacheNode *)loadEntityElement:(NSXMLElement *)entityElement model
break;

case NSDateAttributeType:
objectValue=[NSCalendarDate dateWithNaturalLanguageString:stringValue];
objectValue=nil;
// we don't want to use NSCalendarDate
// objectValue=[NSCalendarDate dateWithNaturalLanguageString:stringValue];
break;

case NSBinaryDataAttributeType:
Expand Down
4 changes: 2 additions & 2 deletions CoreFoundation/CFBase.m
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
6 changes: 5 additions & 1 deletion CoreFoundation/CFNumber.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@

#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;
Expand All @@ -22,3 +24,5 @@ CFNumberType CFNumberGetType(CFNumberRef self) {
Boolean CFBooleanGetValue(CFBooleanRef self) {
return [ToNSNumber(self) boolValue];
}

@end
15 changes: 11 additions & 4 deletions Foundation/NSString/NSPathUtilities.m
Original file line number Diff line number Diff line change
Expand Up @@ -289,16 +289,23 @@ -(const uint16_t *)fileSystemRepresentationW {
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];
}

Expand Down
1 change: 1 addition & 0 deletions Foundation/xml/NSXMLParser.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#import <Foundation/NSMutableDictionary.h>
#import <Foundation/NSMutableArray.h>
#import <Foundation/NSAutoreleasePool.h>
#import <string.h>

enum {
STATE_content,
Expand Down
2 changes: 2 additions & 0 deletions Onyx2D/O2Paint_image.m
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions Onyx2D/O2TTFDecoder.m
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,15 @@ static void dump(O2TTFDecoderRef self,NSString *format,...){
}
}

#if 0
static CFIndex currentPosition(O2TTFDecoderRef self){
return self->_position;
}

static void seekToPosition(O2TTFDecoderRef self,CFIndex value){
self->_position=value;
}
#endif

static uint8_t decode_uint8(O2TTFDecoderRef self){
if(self->_position>=self->_length){
Expand Down
3 changes: 2 additions & 1 deletion Onyx2D/VGPath.m
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion Onyx2D/platform_Windows/O2Context_builtin_gdi.m
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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));
}
Expand Down
2 changes: 1 addition & 1 deletion QuartzCore/CALayerContext.m
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ -(void)renderLayer:(CALayer *)layer intoSurface:(CGLPixelSurface *)pixelSurface

[_renderer render];

[pixelSurface flushBuffer];
[pixelSurface readBuffer];
}

-(void)render {
Expand Down
4 changes: 4 additions & 0 deletions QuartzCore/CARenderer.m
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
#import <OpenGL/OpenGL.h>
#import <Onyx2D/O2Surface.h>

@interface CALayer(private)
-(NSNumber *)_textureId;
@end

@implementation CARenderer

-(CGRect)bounds {
Expand Down

0 comments on commit aab9497

Please sign in to comment.