Improve nullability annotations.

This commit is contained in:
Damiano Galassi committed 2019-03-11 17:42:19 +01:00
1 parent bb1c13f8ab
commit 30978c088a
3 files changed
+11 -5

No files matched your search

+1 -1
View File
@@ -20,7 +20,7 @@ NS_ASSUME_NONNULL_BEGIN
*
* @return The receiver, initialized with the resource specified by URL.
*/
- (instancetype)initWithURL:(NSURL *)URL;
- (nullable instancetype)initWithURL:(NSURL *)URL;
/**
* Returns the complete list of available metadata.
+6 -2
View File
@@ -52,12 +52,16 @@
return self;
}
- (instancetype)initWithURL:(NSURL *)URL;
- (nullable instancetype)initWithURL:(NSURL *)URL;
{
self = [self init];
if (self) {
MP42XMLReader *xmlReader = [[MP42XMLReader alloc] initWithURL:URL error:NULL];
[self mergeMetadata:[xmlReader mMetadata]];
if (xmlReader) {
[self mergeMetadata:[xmlReader mMetadata]];
} else {
return nil;
}
}
return self;
+4 -2
View File
@@ -11,10 +11,10 @@
@implementation MP42XMLReader
- (instancetype)initWithURL:(NSURL *)url error:(NSError * __autoreleasing *)error
- (nullable instancetype)initWithURL:(NSURL *)url error:(NSError * __autoreleasing *)error
{
if (self = [super init]) {
NSXMLDocument *xml = [[NSXMLDocument alloc] initWithContentsOfURL:url options:0 error:NULL];
NSXMLDocument *xml = [[NSXMLDocument alloc] initWithContentsOfURL:url options:0 error:error];
if (xml) {
NSError *err;
_mMetadata = [[MP42Metadata alloc] init];
@@ -25,6 +25,8 @@
nodes = [xml nodesForXPath:@"./video" error:&err];
if ([nodes count] == 1)
[self metadata2ForNode:[nodes objectAtIndex:0]];
} else {
return nil;
}
}
return self;