Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/owncloud/client.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Goetz <markus@woboq.com>2014-10-10 13:44:01 +0400
committerMarkus Goetz <markus@woboq.com>2014-10-10 13:44:40 +0400
commitf8f5a7ceaabb2010012b68bae31649877fbadc9a (patch)
tree06f7f4300578864fd7f1360c99306608203669f6 /shell_integration/MacOSX
parentb01839e9a409579b9e3a60812110eeeac63d0685 (diff)
OS X Overlay Icons: Fix static analyzer warnings
Diffstat (limited to 'shell_integration/MacOSX')
-rw-r--r--shell_integration/MacOSX/OwnCloudFinder/ContentManager.m4
-rw-r--r--shell_integration/MacOSX/OwnCloudFinder/FinishedIconCache.m18
-rw-r--r--shell_integration/MacOSX/OwnCloudFinder/RequestManager.m16
3 files changed, 23 insertions, 15 deletions
diff --git a/shell_integration/MacOSX/OwnCloudFinder/ContentManager.m b/shell_integration/MacOSX/OwnCloudFinder/ContentManager.m
index d0a6659d0..70c0e889d 100644
--- a/shell_integration/MacOSX/OwnCloudFinder/ContentManager.m
+++ b/shell_integration/MacOSX/OwnCloudFinder/ContentManager.m
@@ -185,7 +185,7 @@ static ContentManager* sharedInstance = nil;
}
if( [keysToDelete count] > 0 ) {
- NSLog( @"Entries to delete: %d", [keysToDelete count]);
+ NSLog( @"Entries to delete: %lu", (unsigned long)[keysToDelete count]);
[_fileNamesCache removeObjectsForKeys:keysToDelete];
}
}
@@ -233,7 +233,7 @@ static ContentManager* sharedInstance = nil;
- (void)repaintAllWindowsIfNeeded
{
if (!_hasChangedContent) {
- NSLog(@"%@ Repaint scheduled but not needed", NSStringFromSelector(_cmd));
+ //NSLog(@"%@ Repaint scheduled but not needed", NSStringFromSelector(_cmd));
return;
}
diff --git a/shell_integration/MacOSX/OwnCloudFinder/FinishedIconCache.m b/shell_integration/MacOSX/OwnCloudFinder/FinishedIconCache.m
index bce2f61f7..73c26f2d4 100644
--- a/shell_integration/MacOSX/OwnCloudFinder/FinishedIconCache.m
+++ b/shell_integration/MacOSX/OwnCloudFinder/FinishedIconCache.m
@@ -10,7 +10,7 @@
@interface FinishedIconCacheItem : NSObject
-@property (nonatomic, retain) NSImage *icon;
+@property (nonatomic, strong) NSImage *icon;
@property (nonatomic) NSTimeInterval maxAge;
@end
@@ -18,8 +18,10 @@
@synthesize icon;
@synthesize maxAge;
- (void)dealloc {
- NSLog(@"RELEASE %@ %@", self, self.icon);
- [self.icon release];
+ //NSLog(@"RELEASE %@ %@", self, self.icon);
+ if (self.icon) {
+ [self->icon release];
+ }
[super dealloc];
}
@end
@@ -41,6 +43,12 @@ static FinishedIconCache* sharedInstance = nil;
return self;
}
+- (void)dealloc
+{
+ [_cache dealloc];
+ [super dealloc];
+}
+
+ (FinishedIconCache*)sharedInstance
{
@synchronized(self)
@@ -59,7 +67,7 @@ static FinishedIconCache* sharedInstance = nil;
NSString *cacheKey = [NSString stringWithFormat:@"%@--%d--%f%f", fileName, idx, w,h];
FinishedIconCacheItem *item = [_cache objectForKey:cacheKey];
if (item) {
- if (item.maxAge > [[[NSDate alloc] init] timeIntervalSinceReferenceDate]) {
+ if (item.maxAge > [[NSDate date] timeIntervalSinceReferenceDate]) {
_hits++;
return item.icon;
}
@@ -74,7 +82,7 @@ static FinishedIconCache* sharedInstance = nil;
FinishedIconCacheItem *item = [[FinishedIconCacheItem alloc] init];
item.icon = icon;
// max age between 1 sec and 5 sec
- item.maxAge = [[[NSDate alloc] init] timeIntervalSinceReferenceDate] + 1.0 + 4.0*((double)arc4random() / 0x100000000);
+ item.maxAge = [[NSDate date] timeIntervalSinceReferenceDate] + 1.0 + 4.0*((double)arc4random() / 0x100000000);
[_cache setObject:item forKey:cacheKey cost:w*h];
[item release];
//NSLog(@"CACHE hit/miss ratio: %f", (float)_hits/(float)_misses);
diff --git a/shell_integration/MacOSX/OwnCloudFinder/RequestManager.m b/shell_integration/MacOSX/OwnCloudFinder/RequestManager.m
index 4e6b2e107..e2dcac356 100644
--- a/shell_integration/MacOSX/OwnCloudFinder/RequestManager.m
+++ b/shell_integration/MacOSX/OwnCloudFinder/RequestManager.m
@@ -83,7 +83,7 @@ static RequestManager* sharedInstance = nil;
NSArray *regPathes = [_registeredPathes allKeys];
BOOL registered = NO;
- NSString* checkPath = [[NSString alloc] initWithString:path];
+ NSString* checkPath = [NSString stringWithString:path];
if (isDir) {
// append a slash
checkPath = [path stringByAppendingString:@"/"];
@@ -127,17 +127,17 @@ static RequestManager* sharedInstance = nil;
- (void)socket:(GCDAsyncSocket*)socket didReadData:(NSData*)data withTag:(long)tag
{
- NSArray *chunks;
NSString *answer = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
+ NSArray *chunks = nil;
if (answer != nil && [answer length] > 0) {
// cut a trailing newline
answer = [answer substringToIndex:[answer length] - 1];
chunks = [answer componentsSeparatedByString: @":"];
}
- NSLog(@"READ from socket (%ld): <%@>", tag, answer);
ContentManager *contentman = [ContentManager sharedInstance];
- if( [chunks count] > 0 && tag == READ_TAG ) {
+ if( chunks && [chunks count] > 0 && tag == READ_TAG ) {
+ NSLog(@"READ from socket (%ld): <%@>", tag, answer);
if( [[chunks objectAtIndex:0] isEqualToString:@"STATUS"] ) {
NSString *path = [chunks objectAtIndex:2];
if( [chunks count] > 3 ) {
@@ -168,8 +168,8 @@ static RequestManager* sharedInstance = nil;
} else {
NSLog(@"Unknown command %@", [chunks objectAtIndex:0]);
}
- } else {
- NSLog(@"Received unknown tag %ld", tag);
+ } else if (tag != READ_TAG) {
+ NSLog(@"Received unknown tag %ld <%@>", tag, answer);
}
// Read on and on
NSData* stop = [@"\n" dataUsingEncoding:NSUTF8StringEncoding];
@@ -202,7 +202,7 @@ static RequestManager* sharedInstance = nil;
if( [_requestQueue count] > 0 ) {
NSLog( @"We have to empty the queue");
for( NSString *path in _requestQueue ) {
- [self askOnSocket:path];
+ [self askOnSocket:path query:@"RETRIEVE_FILE_STATUS"];
}
}
@@ -253,7 +253,7 @@ static RequestManager* sharedInstance = nil;
NSLog(@"I goofed: %@", err);
}
} else if (!useTcp) {
- NSURL *url;
+ NSURL *url = nil;
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
if ([paths count])
{