diff --git a/IJSVGExample/IJSVGExample.xcodeproj/project.xcworkspace/xcuserdata/curtishard.xcuserdatad/UserInterfaceState.xcuserstate b/IJSVGExample/IJSVGExample.xcodeproj/project.xcworkspace/xcuserdata/curtishard.xcuserdatad/UserInterfaceState.xcuserstate index eb0ff94..81be11a 100644 Binary files a/IJSVGExample/IJSVGExample.xcodeproj/project.xcworkspace/xcuserdata/curtishard.xcuserdatad/UserInterfaceState.xcuserstate and b/IJSVGExample/IJSVGExample.xcodeproj/project.xcworkspace/xcuserdata/curtishard.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/source/IJSVGCache.h b/source/IJSVGCache.h index 211ae7b..4ccf3f0 100644 --- a/source/IJSVGCache.h +++ b/source/IJSVGCache.h @@ -7,6 +7,7 @@ // #import +#import #import "IJSVG.h" @interface IJSVGCache : NSObject { diff --git a/source/IJSVGCache.m b/source/IJSVGCache.m index ece4f62..f9c8f55 100644 --- a/source/IJSVGCache.m +++ b/source/IJSVGCache.m @@ -36,10 +36,16 @@ static BOOL _enabled = YES; fileURL:(NSURL *)aURL { // use the malloc size for the object size, + // actually bad idea, use the file size // is this correct? + struct stat st; + long cost = 0; + if( lstat( [[aURL path] cStringUsingEncoding:NSUTF8StringEncoding], &st ) != -1 ) + cost = st.st_size; + [_cache setObject:svg forKey:aURL - cost:malloc_size(svg)]; + cost:cost]; } + (void)setEnabled:(BOOL)flag