Skip to content

Commit

Permalink
fix: analyzer warnings on non-null value
Browse files Browse the repository at this point in the history
  • Loading branch information
relikd committed Oct 1, 2022
1 parent 3648116 commit af89e58
Show file tree
Hide file tree
Showing 18 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion baRSS/Core Data/Feed+Ext.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ NS_ASSUME_NONNULL_BEGIN
- (void)calculateAndSetIndexPathString;
- (void)setNewIcon:(NSURL*)location;
// Article properties
- (NSArray<FeedArticle*>*)sortedArticles;
- (nullable NSArray<FeedArticle*>*)sortedArticles;
@end

NS_ASSUME_NONNULL_END
2 changes: 1 addition & 1 deletion baRSS/Core Data/Feed+Ext.m
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ - (NSUInteger)deleteArticles:(NSMutableSet<FeedArticle*>*)localSet withRemoteSet
/**
@return Articles sorted by attribute @c sortIndex with descending order (newest items first).
*/
- (NSArray<FeedArticle*>*)sortedArticles {
- (nullable NSArray<FeedArticle*>*)sortedArticles {
if (self.articles.count == 0)
return nil;
return [self.articles sortedArrayUsingDescriptors:@[[NSSortDescriptor sortDescriptorWithKey:@"sortIndex" ascending:NO]]];
Expand Down
2 changes: 1 addition & 1 deletion baRSS/Core Data/FeedGroup+Ext.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ NS_ASSUME_NONNULL_BEGIN
- (NSMenuItem*)newMenuItem;
// Handle children and parents
- (NSString*)indexPathString;
- (NSArray<FeedGroup*>*)sortedChildren;
- (nullable NSArray<FeedGroup*>*)sortedChildren;
- (NSMutableArray<FeedGroup*>*)allParents;
// Printing
- (NSString*)readableDescription;
Expand Down
2 changes: 1 addition & 1 deletion baRSS/Core Data/FeedGroup+Ext.m
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ - (NSString*)indexPathString {
}

/// @return Children sorted by attribute @c sortIndex (same order as in preferences).
- (NSArray<FeedGroup*>*)sortedChildren {
- (nullable NSArray<FeedGroup*>*)sortedChildren {
if (self.children.count == 0)
return nil;
return [self.children sortedArrayUsingDescriptors:@[[NSSortDescriptor sortDescriptorWithKey:@"sortIndex" ascending:YES]]];
Expand Down
2 changes: 1 addition & 1 deletion baRSS/Feed Import/Download3rdParty.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ NS_ASSUME_NONNULL_BEGIN

// TODO: Make plugins extensible? community extensions.
@interface YouTubePlugin : NSObject
+ (NSString*)feedURL:(NSURL*)url data:(NSData*)html;
+ (nullable NSString*)feedURL:(NSURL*)url data:(NSData*)html;
+ (NSString*)videoImage:(NSString*)videoid;
+ (NSString*)videoImageHQ:(NSString*)videoid;
@end
Expand Down
2 changes: 1 addition & 1 deletion baRSS/Feed Import/Download3rdParty.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ @implementation YouTubePlugin
@return @c nil if @c url is not properly formatted, YouTube feed URL otherwise.
*/
+ (NSString*)feedURL:(NSURL*)url data:(NSData*)html {
+ (nullable NSString*)feedURL:(NSURL*)url data:(NSData*)html {
if (![url.host hasSuffix:@"youtube.com"]) // 'youtu.be' & 'youtube-nocookie.com' will redirect
return nil;
// https://www.youtube.com/channel/[channel-id]
Expand Down
2 changes: 1 addition & 1 deletion baRSS/Feed Import/FaviconDownload.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ typedef void(^FaviconDownloadBlock)(NSImage * _Nullable img, NSURL * _Nullable p
- (instancetype)startWithBlock:(nonnull FaviconDownloadBlock)block;
- (void)cancel;
// Extract from HTML metadata
+ (nullable NSString*)urlForMetadata:(RSHTMLMetadata*)meta;
+ (nullable NSString*)urlForMetadata:(nullable RSHTMLMetadata*)meta;
@end


Expand Down
2 changes: 1 addition & 1 deletion baRSS/Feed Import/FaviconDownload.m
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ - (void)finishAndNotify {
// ---------------------------------------------------------------

/// Extract favicon URL from parsed HTML metadata.
+ (nullable NSString*)urlForMetadata:(RSHTMLMetadata*)meta {
+ (nullable NSString*)urlForMetadata:(nullable RSHTMLMetadata*)meta {
if (!meta) return nil;

double bestScore = DBL_MAX;
Expand Down
2 changes: 1 addition & 1 deletion baRSS/Feed Import/FeedDownload.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ typedef void (^FeedDownloadBlock)(FeedDownload *sender);
@protocol FeedDownloadDelegate <NSObject>
@optional
/// Delegate must return chosen URL. If not implemented, the first URL will be used.
- (NSString*)feedDownload:(FeedDownload*)sender selectFeedFromList:(NSArray<RSHTMLMetadataFeedLink*>*)list;
- (nullable NSString*)feedDownload:(FeedDownload*)sender selectFeedFromList:(NSArray<RSHTMLMetadataFeedLink*>*)list;
/// Only called if an URL redirect occured.
- (void)feedDownload:(FeedDownload*)sender urlRedirected:(NSString*)newURL;
/// Called after xml data is loaded and parsed. Called on error, but not if download is cancled.
Expand Down
2 changes: 1 addition & 1 deletion baRSS/Feed Import/FeedDownload.m
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ - (void)processXMLDataHTML:(RSXMLData*)xml {
self.error = [NSError canceledByUser];
}
// finalize HTML parsing
if (self.error) {
if (self.error || !feedURL) {
[self finishAndNotify];
} else {
self.assertIsFeedURL = YES;
Expand Down
2 changes: 1 addition & 1 deletion baRSS/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>14690</string>
<string>14695</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.news</string>
<key>LSMinimumSystemVersion</key>
Expand Down
2 changes: 1 addition & 1 deletion baRSS/NSCategories/NSDate+Ext.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ NS_ASSUME_NONNULL_BEGIN


@interface NSDate (Statistics)
+ (NSDictionary*)refreshIntervalStatistics:(NSArray<NSDate*> *)list;
+ (nullable NSDictionary*)refreshIntervalStatistics:(NSArray<NSDate*> *)list;
@end

NS_ASSUME_NONNULL_END
2 changes: 1 addition & 1 deletion baRSS/NSCategories/NSDate+Ext.m
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ @implementation NSDate (Statistics)
/**
@return @c nil if list contains less than 2 entries. Otherwise: @{min, max, avg, median, earliest, latest}
*/
+ (NSDictionary*)refreshIntervalStatistics:(NSArray<NSDate*> *)list {
+ (nullable NSDictionary*)refreshIntervalStatistics:(NSArray<NSDate*> *)list {
if (!list || list.count == 0)
return nil;

Expand Down
4 changes: 2 additions & 2 deletions baRSS/NSCategories/NSView+Ext.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ static inline CGFloat NSMaxWidth(NSView *a, NSView *b) { return Max(NSWidth(a.fr
+ (NSImageView*)imageView:(nullable NSImageName)name size:(CGFloat)size;
+ (NSButton*)checkbox:(BOOL)flag;
+ (NSProgressIndicator*)activitySpinner;
+ (NSView*)radioGroup:(NSArray<NSString*>*)entries target:(id)target action:(nonnull SEL)action;
+ (NSView*)radioGroup:(NSArray<NSString*>*)entries;
+ (nullable NSView*)radioGroup:(NSArray<NSString*>*)entries target:(id)target action:(nonnull SEL)action;
+ (nullable NSView*)radioGroup:(NSArray<NSString*>*)entries;
// UI: Enclosing Container
+ (NSPopover*)popover:(NSSize)size;
- (NSScrollView*)wrapContent:(NSView*)content inScrollView:(NSRect)rect;
Expand Down
4 changes: 2 additions & 2 deletions baRSS/NSCategories/NSView+Ext.m
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ + (NSProgressIndicator*)activitySpinner {
}

/// Create grouping view with vertically, left-aligned radio buttons. Action is identical for all buttons (grouping).
+ (NSView*)radioGroup:(NSArray<NSString*>*)entries target:(id)target action:(nonnull SEL)action {
+ (nullable NSView*)radioGroup:(NSArray<NSString*>*)entries target:(id)target action:(nonnull SEL)action {
if (entries.count == 0)
return nil;
CGFloat w = 0, h = 0;
Expand All @@ -145,7 +145,7 @@ + (NSView*)radioGroup:(NSArray<NSString*>*)entries target:(id)target action:(non
}

/// Same as @c radioGroup:target:action: but using dummy action to ignore radio button click events.
+ (NSView*)radioGroup:(NSArray<NSString*>*)entries {
+ (nullable NSView*)radioGroup:(NSArray<NSString*>*)entries {
return [self radioGroup:entries target:self action:@selector(donothing)];
}

Expand Down
2 changes: 1 addition & 1 deletion baRSS/Preferences/Feeds Tab/ModalFeedEdit.m
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ - (void)downloadRSS {
@return Either URL string or @c nil if user canceled the selection.
*/
- (NSString*)feedDownload:(FeedDownload*)sender selectFeedFromList:(NSArray<RSHTMLMetadataFeedLink*>*)list {
- (nullable NSString*)feedDownload:(FeedDownload*)sender selectFeedFromList:(NSArray<RSHTMLMetadataFeedLink*>*)list {
NSMenu *menu = [[NSMenu alloc] initWithTitle:NSLocalizedString(@"Choose feed menu", nil)];
menu.autoenablesItems = NO;
for (RSHTMLMetadataFeedLink *fl in list) {
Expand Down
2 changes: 1 addition & 1 deletion baRSS/Status Bar Menu/NSMenu+Ext.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ NS_ASSUME_NONNULL_BEGIN
- (void)insertDefaultHeader;
// Update menu
- (void)setHeaderHasUnread:(BOOL)hasUnread hasRead:(BOOL)hasRead;
- (NSMenuItem*)deepestItemWithPath:(nonnull NSString*)path;
- (nullable NSMenuItem*)deepestItemWithPath:(nonnull NSString*)path;
@end


Expand Down
2 changes: 1 addition & 1 deletion baRSS/Status Bar Menu/NSMenu+Ext.m
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ - (void)setHeaderHasUnread:(BOOL)hasUnread hasRead:(BOOL)hasRead {
@param path Dot separated list of @c sortIndex. E.g., @c Feed.indexPath.
@return Either @c NSMenuItem that exactly matches @c path or one of the parent @c NSMenuItem if a submenu isn't open.
*/
- (NSMenuItem*)deepestItemWithPath:(nonnull NSString*)path {
- (nullable NSMenuItem*)deepestItemWithPath:(nonnull NSString*)path {
NSUInteger loc = [path rangeOfString:@"."].location;
BOOL isLast = (loc == NSNotFound);
NSString *indexStr = (isLast ? path : [path substringToIndex:loc]);
Expand Down

0 comments on commit af89e58

Please sign in to comment.