Revision: 29023 http://sourceforge.net/p/bibdesk/svn/29023 Author: hofman Date: 2025-02-18 23:14:48 +0000 (Tue, 18 Feb 2025) Log Message: ----------- add nullability to networking classes
Modified Paths: -------------- trunk/bibdesk/BDSKAuthenticationController.h trunk/bibdesk/BDSKAuthenticationHandler.h trunk/bibdesk/BDSKBibDeskProtocol.h trunk/bibdesk/BDSKDownloadManager.h trunk/bibdesk/BDSKDownloader.h trunk/bibdesk/BDSKItemDownload.h trunk/bibdesk/BDSKURLGroup.m Modified: trunk/bibdesk/BDSKAuthenticationController.h =================================================================== --- trunk/bibdesk/BDSKAuthenticationController.h 2025-02-18 22:47:48 UTC (rev 29022) +++ trunk/bibdesk/BDSKAuthenticationController.h 2025-02-18 23:14:48 UTC (rev 29023) @@ -39,6 +39,7 @@ #import <Cocoa/Cocoa.h> #import "BDSKDownloader.h" +NS_ASSUME_NONNULL_BEGIN @interface BDSKAuthenticationController : NSWindowController { NSTextField *mainLabelField; @@ -57,7 +58,7 @@ @property (nonatomic, strong) IBOutlet NSTextField *userField; @property (nonatomic, strong) IBOutlet NSButton *rememberButton; -- (void)runAuthentication:(NSURLAuthenticationChallenge *)challenge window:(NSWindow *)window completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *credential))completionHandler; +- (void)runAuthentication:(NSURLAuthenticationChallenge *)challenge window:(nullable NSWindow *)window completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential * _Nullable credential))completionHandler; @end @@ -64,3 +65,4 @@ @interface BDSKNonBlockingPanel : NSPanel @end +NS_ASSUME_NONNULL_END Modified: trunk/bibdesk/BDSKAuthenticationHandler.h =================================================================== --- trunk/bibdesk/BDSKAuthenticationHandler.h 2025-02-18 22:47:48 UTC (rev 29022) +++ trunk/bibdesk/BDSKAuthenticationHandler.h 2025-02-18 23:14:48 UTC (rev 29023) @@ -39,6 +39,7 @@ #import <Cocoa/Cocoa.h> #import "BDSKDownloader.h" +NS_ASSUME_NONNULL_BEGIN @interface BDSKAuthenticationHandler : NSObject { NSMapTable *controllers; @@ -47,6 +48,8 @@ @property (class, nonatomic, readonly) BDSKAuthenticationHandler *sharedHandler; -- (void)startAuthentication:(NSURLAuthenticationChallenge *)challenge window:(NSWindow *)window completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *credential))completionHandler; +- (void)startAuthentication:(NSURLAuthenticationChallenge *)challenge window:(nullable NSWindow *)window completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential * _Nullable credential))completionHandler; @end + +NS_ASSUME_NONNULL_END Modified: trunk/bibdesk/BDSKBibDeskProtocol.h =================================================================== --- trunk/bibdesk/BDSKBibDeskProtocol.h 2025-02-18 22:47:48 UTC (rev 29022) +++ trunk/bibdesk/BDSKBibDeskProtocol.h 2025-02-18 23:14:48 UTC (rev 29023) @@ -39,7 +39,11 @@ #import <Cocoa/Cocoa.h> +NS_ASSUME_NONNULL_BEGIN + extern NSString *BDSKBibDeskScheme; @interface BDSKBibDeskProtocol : NSURLProtocol @end + +NS_ASSUME_NONNULL_END Modified: trunk/bibdesk/BDSKDownloadManager.h =================================================================== --- trunk/bibdesk/BDSKDownloadManager.h 2025-02-18 22:47:48 UTC (rev 29022) +++ trunk/bibdesk/BDSKDownloadManager.h 2025-02-18 23:14:48 UTC (rev 29023) @@ -39,6 +39,8 @@ #import <Cocoa/Cocoa.h> #import <WebKit/WebKit.h> +NS_ASSUME_NONNULL_BEGIN + typedef NS_ENUM(NSInteger, BDSKDownloadStatus) { BDSKDownloadStatusDownloading, BDSKDownloadStatusFinished, @@ -77,8 +79,10 @@ @property (nonatomic, readonly) NSURLDownload *URLDownload; @property (nonatomic, readonly) NSUInteger uniqueID; @property (nonatomic, readonly) NSURL *URL; -@property (nonatomic, strong) NSURL *fileURL; -@property (nonatomic, readonly) NSString *fileName; +@property (nonatomic, nullable, strong) NSURL *fileURL; +@property (nonatomic, nullable, readonly) NSString *fileName; @property (nonatomic) BDSKDownloadStatus status; @end + +NS_ASSUME_NONNULL_END Modified: trunk/bibdesk/BDSKDownloader.h =================================================================== --- trunk/bibdesk/BDSKDownloader.h 2025-02-18 22:47:48 UTC (rev 29022) +++ trunk/bibdesk/BDSKDownloader.h 2025-02-18 23:14:48 UTC (rev 29023) @@ -38,6 +38,8 @@ #import <Cocoa/Cocoa.h> +NS_ASSUME_NONNULL_BEGIN + @class BDSKDownload; @protocol BDSKDownloadDelegate; @@ -51,8 +53,8 @@ - (BDSKDownload *)startFileDownloadWithRequest:(NSURLRequest *)request delegate:(id <BDSKDownloadDelegate>)aDelegate; - (BDSKDownload *)startDataDownloadWithRequest:(NSURLRequest *)request delegate:(id <BDSKDownloadDelegate>)aDelegate; -- (NSData *)downloadDataWithRequest:(NSURLRequest *)request returningResponse:(NSURLResponse **)response error:(NSError **)error; -- (NSURLSessionTask *)downloadDataWithRequest:(NSURLRequest *)request completionHandler:(void (^)(NSData *data, NSURLResponse *response, NSError *error))completionHandler; +- (nullable NSData *)downloadDataWithRequest:(NSURLRequest *)request returningResponse:(NSURLResponse * _Nullable * _Nullable)response error:(NSError **)error; +- (NSURLSessionTask *)downloadDataWithRequest:(NSURLRequest *)request completionHandler:(void (^)(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error))completionHandler; @end @@ -65,10 +67,10 @@ BOOL receivedExpectedBytes; } -@property (nonatomic, strong) id <BDSKDownloadDelegate> delegate; -@property (nonatomic, strong) NSURLSessionTask *task; -@property (nonatomic, readonly) NSURLResponse *response; -@property (nonatomic, strong) NSMutableData *data; +@property (nonatomic, nullable, strong) id <BDSKDownloadDelegate> delegate; +@property (nonatomic, nullable, strong) NSURLSessionTask *task; +@property (nonatomic, nullable, readonly) NSURLResponse *response; +@property (nonatomic, nullable, strong) NSMutableData *data; @property (nonatomic) BOOL receivedExpectedBytes; - (void)cancel; @@ -81,7 +83,7 @@ @required -- (void)download:(BDSKDownload *)download didCompleteWithError:(NSError *)error; +- (void)download:(BDSKDownload *)download didCompleteWithError:(nullable NSError *)error; @optional @@ -89,7 +91,7 @@ - (void)download:(BDSKDownload *)download didReceiveExpectedContentLength:(int64_t)expectedContentLength; - (void)download:(BDSKDownload *)download didReceiveDataOfLength:(uint64_t)length; -- (void)download:(BDSKDownload *)download didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *credential))completionHandler; +- (void)download:(BDSKDownload *)download didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential * _Nullable credential))completionHandler; - (NSWindow *)downloadWindowForAuthenticationSheet:(BDSKDownload *)download; // only for file downloads @@ -97,3 +99,5 @@ - (void)download:(BDSKDownload *)download didCreateDestination:(NSURL *)destinationURL; @end + +NS_ASSUME_NONNULL_END Modified: trunk/bibdesk/BDSKItemDownload.h =================================================================== --- trunk/bibdesk/BDSKItemDownload.h 2025-02-18 22:47:48 UTC (rev 29022) +++ trunk/bibdesk/BDSKItemDownload.h 2025-02-18 23:14:48 UTC (rev 29023) @@ -39,6 +39,8 @@ #import <Cocoa/Cocoa.h> #import "BDSKDownloader.h" +NS_ASSUME_NONNULL_BEGIN + @protocol BDSKItemDownloadDelegate; @class BDSKLinkedFile; @@ -54,14 +56,14 @@ NSURL *fileURL; } -@property (nonatomic, weak) id <BDSKItemDownloadDelegate> delegate; -@property (nonatomic, readonly) BDSKLinkedFile *linkedFile; +@property (nonatomic, nullable, weak) id <BDSKItemDownloadDelegate> delegate; +@property (nonatomic, nullable, readonly) BDSKLinkedFile *linkedFile; @property (nonatomic, readonly) NSURL *URL; -@property (nonatomic, readonly) NSURLResponse *response; +@property (nonatomic, nullable, readonly) NSURLResponse *response; @property (nonatomic) NSUInteger index; @property (nonatomic, readonly) NSUInteger options; @property (nonatomic, readonly) double progress; -@property (nonatomic, readonly) NSURL *fileURL; +@property (nonatomic, nullable, readonly) NSURL *fileURL; - (instancetype)initWithLinkedFile:(BDSKLinkedFile *)aLinkedFile atIndex:(NSUInteger)anIndex options:(NSUInteger)anOptions; - (instancetype)initWithURL:(NSURL *)aURL options:(NSUInteger)anOptions; @@ -76,7 +78,8 @@ - (void)itemDownloadDidStart:(BDSKItemDownload *)download; - (void)itemDownloadDidUpdate:(BDSKItemDownload *)download; - (void)itemDownloadDidFinish:(BDSKItemDownload *)download; -- (NSWindow *)itemDownloadWindowForAuthenticationSheet:(BDSKItemDownload *)download; +- (nullable NSWindow *)itemDownloadWindowForAuthenticationSheet:(BDSKItemDownload *)download; @end +NS_ASSUME_NONNULL_END Modified: trunk/bibdesk/BDSKURLGroup.m =================================================================== --- trunk/bibdesk/BDSKURLGroup.m 2025-02-18 22:47:48 UTC (rev 29022) +++ trunk/bibdesk/BDSKURLGroup.m 2025-02-18 23:14:48 UTC (rev 29023) @@ -202,7 +202,7 @@ [error setValue:NSLocalizedString(@"The URL points to a file that does not exist", @"Error description") forKey:NSLocalizedDescriptionKey]; [error setValue:[theURL path] forKey:NSFilePathErrorKey]; [download cancel]; - [self download:nil didCompleteWithError:error]; + [self download:download didCompleteWithError:error]; } } else { NSURLRequest *request = [NSURLRequest requestWithURL:theURL]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. _______________________________________________ Bibdesk-commit mailing list Bibdesk-commit@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bibdesk-commit