Skip to content

Commit

Permalink
Fixes for bugs found by the Clang static analyzer.
Browse files Browse the repository at this point in the history
  • Loading branch information
AlanQuatermain committed Jul 2, 2009
1 parent 3c96294 commit ad27dbf
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 20 deletions.
2 changes: 1 addition & 1 deletion Compression/AQGzipFileStream.m
Expand Up @@ -512,7 +512,7 @@ - (void) _postEventToDelegate: (NSStreamEvent) event
[_delegate stream: self handleEvent: event];
}

- (NSInteger) write: (uint8_t *) buffer maxLength: (NSUInteger) len
- (NSInteger) write: (uint8_t const *) buffer maxLength: (NSUInteger) len
{
if ( _status != NSStreamStatusOpen )
return ( 0 );
Expand Down
6 changes: 4 additions & 2 deletions Compression/AQGzipInputStream.m
Expand Up @@ -316,9 +316,11 @@ - (id) propertyForKey: (NSString *) key
return ( [_compressedDataStream propertyForKey: key] );
}

- (void) setProperty: (id) property forKey: (NSString *) key
- (BOOL) setProperty: (id) property forKey: (NSString *) key
{
[_compressedDataStream setProperty: property forKey: key];
if ( [_compressedDataStream setProperty: property forKey: key] == NO )
return ( [super setProperty: property forKey: key] );
return ( YES );
}

@end
6 changes: 4 additions & 2 deletions Compression/AQGzipOutputStream.m
Expand Up @@ -297,9 +297,11 @@ - (id) propertyForKey: (NSString *) key
return ( [_outputStream propertyForKey: key] );
}

- (void) setProperty: (id) property forKey: (NSString *) key
- (BOOL) setProperty: (id) property forKey: (NSString *) key
{
[_outputStream setProperty: property forKey: key];
if ( [_outputStream setProperty: property forKey: key] == NO )
return ( [super setProperty: property forKey: key] );
return ( YES );
}

@end
9 changes: 9 additions & 0 deletions Contacts/README.textile
@@ -0,0 +1,9 @@
h2. Contacts has moved!

The AddressBook Objective-C wrappers for iPhone are now "in their own project":http://github.com/alanQuatermain/iPhoneContacts. The reason for this is twofold:

1. The AQToolkit is based around hybrid code which can be used on both the Mac and iPhone. This wrapper API, by its very design, works only on the iPhone --- it uses the iPhone-only AddressBook framework, which has C APIs in the same header files used for the ObjC versions on the Mac. This makes it difficult to build AQToolkit as a complete library (my testing stuff is actually based around 10.5 and 10.6 builds, not iPhone).

2. The classes in this API are useful enough on their own, and involve enough classes, that it seems a good idea to separate it out from everything else in this generic toolkit project.

If you want the latest code (this move coincides with a minor update to the code itself) then you can "find it here":http://github.com/alanQuatermain/iPhoneContacts.
5 changes: 4 additions & 1 deletion Extensions/NSError+CFStreamError.m
Expand Up @@ -142,7 +142,10 @@ + (NSError *) errorFromCFStreamError: (CFStreamError) streamError
}
}

return ( [NSError errorWithDomain: domain code: code userInfo: userInfo] );
NSError * result = [NSError errorWithDomain: domain code: code userInfo: userInfo];
[userInfo release];

return ( result );
}

@end
1 change: 1 addition & 0 deletions FSEventsWrapper/.gitignore
@@ -0,0 +1 @@
build
5 changes: 3 additions & 2 deletions LowLevelFSEvents/FSEventManager.m
Expand Up @@ -217,7 +217,7 @@ @implementation FSEventManager (Internal)

- (BOOL) setupFSEventListener
{
int clonefd;
int clonefd = -1;
struct fsevent_clone_args clone_args;
int8_t event_list[] = {
FSE_REPORT, // create file
Expand Down Expand Up @@ -342,6 +342,8 @@ - (void) waitForEvents
FSEvent * event = [[FSEvent alloc] init];
event.eventCode = pEvt->type & FSE_TYPE_MASK;
event.processID = pEvt->pid;

BOOL isVnode = NO;

// read arguments
kfs_event_arg_t *pArg = pEvt->args;
Expand All @@ -356,7 +358,6 @@ - (void) waitForEvents

int argOffset = sizeof(pArg->type) + sizeof(pArg->len) + pArg->len;
offset += argOffset;
BOOL isVnode = NO;

int argType = (pArg->type > FSE_MAX_ARGS) ? 0 : pArg->type;
switch ( argType )
Expand Down
10 changes: 5 additions & 5 deletions LowMemoryDownload/AQConnectionMultiplexer.m
Expand Up @@ -132,11 +132,6 @@ - (void) terminate
[self autorelease];
}

- (void) _terminate
{
[self _cancelTransfers];
}

- (void) _addHelper: (AQLowMemoryDownloadHelper *) helper
{
@synchronized(_downloadHelpers)
Expand Down Expand Up @@ -164,6 +159,11 @@ - (void) _cancelTransfers
}
}

- (void) _terminate
{
[self _cancelTransfers];
}

- (void) main
{
NSAutoreleasePool * rootPool = [[NSAutoreleasePool alloc] init];
Expand Down
1 change: 1 addition & 0 deletions LowMemoryDownload/AQLowMemoryDownloadHelper.m
Expand Up @@ -124,6 +124,7 @@ + (void) handleAsyncRequest: (NSURLRequest *) request
obj.asyncDelegate = delegate;

[obj _performAsynchronousRequest: request];
[obj release];
}

- (id) init
Expand Down
9 changes: 2 additions & 7 deletions StreamingXMLParser/AQXMLParser.m
Expand Up @@ -919,10 +919,6 @@ - (BOOL) parseAsynchronouslyUsingRunLoop: (NSRunLoop *) runloop
if ( _stream == nil )
return ( NO );

xmlSAXHandlerPtr saxHandler = NULL;
if ( self.delegate != nil )
saxHandler = _internal->saxHandler;

// see if bytes are already available on the stream
// if there are, we'll grab the first 4 bytes and use those to compute the encoding
// otherwise, we'll just go with no initial data
Expand Down Expand Up @@ -1242,11 +1238,10 @@ - (void) _setupExpectedLength
return;
}

CFNumberRef num = (CFNumberRef) [_stream propertyForKey: (NSString *)kCFStreamPropertyFTPResourceSize];
NSNumber * num = [_stream propertyForKey: (NSString *)kCFStreamPropertyFTPResourceSize];
if ( num != NULL )
{
_internal->expectedDataLength = [(NSNumber *)num floatValue];
CFRelease( num );
_internal->expectedDataLength = [num floatValue];
return;
}

Expand Down

0 comments on commit ad27dbf

Please sign in to comment.