Deprecation warning fixes

This commit is contained in:
David Sinclair 2022-11-09 21:38:40 -07:00
parent 22bbdf0e03
commit c3a21924b6
6 changed files with 29 additions and 12 deletions

View file

@ -440,8 +440,7 @@
BGAppRefreshTaskRequest *request = [[BGAppRefreshTaskRequest alloc] initWithIdentifier:@"com.newsblur.NewsBlur.refresh"];
NSError *error = nil;
#warning hack
// request.earliestBeginDate = [NSDate dateWithTimeIntervalSinceNow:15 * 60];
request.earliestBeginDate = [NSDate dateWithTimeIntervalSinceNow:15 * 60];
[BGTaskScheduler.sharedScheduler submitTaskRequest:request error:&error];
}

View file

@ -94,6 +94,8 @@ void drawLinearGradient(CGContextRef context, CGRect rect, CGColorRef startColor
}
+ (NSString *)md5:(NSString *)string {
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
const char *cStr = [string UTF8String];
unsigned char result[16];
CC_MD5( cStr, (CC_LONG)strlen(cStr), result ); // This is the md5 call
@ -104,6 +106,7 @@ void drawLinearGradient(CGContextRef context, CGRect rect, CGColorRef startColor
result[8], result[9], result[10], result[11],
result[12], result[13], result[14], result[15]
];
#pragma GCC diagnostic pop
}
+ (NSString *)formatLongDateFromTimestamp:(NSInteger)timestamp {

View file

@ -4348,7 +4348,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = NO;
CLANG_ENABLE_MODULES = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
@ -4402,7 +4402,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = NO;
CLANG_ENABLE_MODULES = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;

View file

@ -59,10 +59,13 @@ static id AFPublicKeyForCertificate(NSData *certificate) {
__Require_Quiet(allowedCertificate != NULL, _out);
policy = SecPolicyCreateBasicX509();
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
__Require_noErr_Quiet(SecTrustCreateWithCertificates(allowedCertificate, policy, &allowedTrust), _out);
__Require_noErr_Quiet(SecTrustEvaluate(allowedTrust, &result), _out);
allowedPublicKey = (__bridge_transfer id)SecTrustCopyPublicKey(allowedTrust);
#pragma GCC diagnostic pop
_out:
if (allowedTrust) {
@ -83,8 +86,11 @@ _out:
static BOOL AFServerTrustIsValid(SecTrustRef serverTrust) {
BOOL isValid = NO;
SecTrustResultType result;
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
__Require_noErr_Quiet(SecTrustEvaluate(serverTrust, &result), _out);
#pragma GCC diagnostic pop
isValid = (result == kSecTrustResultUnspecified || result == kSecTrustResultProceed);
_out:
@ -117,10 +123,13 @@ static NSArray * AFPublicKeyTrustChainForServerTrust(SecTrustRef serverTrust) {
__Require_noErr_Quiet(SecTrustCreateWithCertificates(certificates, policy, &trust), _out);
SecTrustResultType result;
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
__Require_noErr_Quiet(SecTrustEvaluate(trust, &result), _out);
[trustChain addObject:(__bridge_transfer id)SecTrustCopyPublicKey(trust)];
#pragma GCC diagnostic pop
_out:
if (trust) {
CFRelease(trust);

View file

@ -317,7 +317,7 @@ typedef NS_ENUM(NSUInteger, PINDiskCacheCondition) {
[_dates setObject:date forKey:key];
NSNumber *fileSize = [dictionary objectForKey:NSURLTotalFileAllocatedSizeKey];
if (fileSize) {
if (fileSize && key) {
[_sizes setObject:fileSize forKey:key];
byteCount += [fileSize unsignedIntegerValue];
}
@ -666,7 +666,10 @@ typedef NS_ENUM(NSUInteger, PINDiskCacheCondition) {
// If the cache should behave like a TTL cache, then only fetch the object if there's a valid ageLimit and the object is still alive
(!self->_ttlCache || self->_ageLimit <= 0 || fabs([[_dates objectForKey:key] timeIntervalSinceDate:now]) < self->_ageLimit)) {
@try {
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
object = [NSKeyedUnarchiver unarchiveObjectWithFile:[fileURL path]];
#pragma GCC diagnostic pop
}
@catch (NSException *exception) {
NSError *error = nil;
@ -748,10 +751,13 @@ typedef NS_ENUM(NSUInteger, PINDiskCacheCondition) {
if (self->_willAddObjectBlock)
self->_willAddObjectBlock(self, key, object, fileURL);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
NSData *data = [NSKeyedArchiver archivedDataWithRootObject:object];
NSError *writeError = nil;
#pragma GCC diagnostic pop
BOOL written = [data writeToURL:fileURL options:writeOptions error:&writeError];
PINDiskCacheError(writeError);

View file

@ -471,8 +471,8 @@ static void TMReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkRea
- (NSString *) description
{
NSString *description = [NSString stringWithFormat:@"<%@: %#x (%@)>",
NSStringFromClass([self class]), (unsigned int) self, [self currentReachabilityFlags]];
NSString *description = [NSString stringWithFormat:@"<%@: %#lx (%@)>",
NSStringFromClass([self class]), (unsigned long) self, [self currentReachabilityFlags]];
return description;
}