[Pkg-owncloud-commits] [owncloud-client] 38/211: OS X Overlay Icons: Fix static analyzer warnings
Sandro Knauß
hefee-guest at moszumanska.debian.org
Sat Oct 25 09:10:24 UTC 2014
This is an automated email from the git hooks/post-receive script.
hefee-guest pushed a commit to branch master
in repository owncloud-client.
commit f8f5a7ceaabb2010012b68bae31649877fbadc9a
Author: Markus Goetz <markus at woboq.com>
Date: Fri Oct 10 11:44:01 2014 +0200
OS X Overlay Icons: Fix static analyzer warnings
---
.../MacOSX/OwnCloudFinder/ContentManager.m | 4 ++--
.../MacOSX/OwnCloudFinder/FinishedIconCache.m | 18 +++++++++++++-----
.../MacOSX/OwnCloudFinder/RequestManager.m | 16 ++++++++--------
3 files changed, 23 insertions(+), 15 deletions(-)
diff --git a/shell_integration/MacOSX/OwnCloudFinder/ContentManager.m b/shell_integration/MacOSX/OwnCloudFinder/ContentManager.m
index d0a6659..70c0e88 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 bce2f61..73c26f2 100644
--- a/shell_integration/MacOSX/OwnCloudFinder/FinishedIconCache.m
+++ b/shell_integration/MacOSX/OwnCloudFinder/FinishedIconCache.m
@@ -10,7 +10,7 @@
@interface FinishedIconCacheItem : NSObject
- at property (nonatomic, retain) NSImage *icon;
+ at 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 4e6b2e1..e2dcac3 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])
{
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git
More information about the Pkg-owncloud-commits
mailing list