Fix some compiler warnings

pull/1/head
Michael Kirk 7 years ago
parent 8354a9c13f
commit d591fb7f2c

@ -925,7 +925,7 @@ static NSTimeInterval launchStartedAt;
- (void)application:(UIApplication *)application - (void)application:(UIApplication *)application
handleActionWithIdentifier:(NSString *)identifier handleActionWithIdentifier:(NSString *)identifier
forLocalNotification:(UILocalNotification *)notification forLocalNotification:(UILocalNotification *)notification
completionHandler:(void (^)())completionHandler completionHandler:(void (^)(void))completionHandler
{ {
OWSAssertIsOnMainThread(); OWSAssertIsOnMainThread();

@ -26,7 +26,8 @@ public class MessageFetcherJob: NSObject {
SwiftSingletons.register(self) SwiftSingletons.register(self)
} }
@discardableResult public func run() -> Promise<Void> { @discardableResult
public func run() -> Promise<Void> {
Logger.debug("\(self.logTag) in \(#function)") Logger.debug("\(self.logTag) in \(#function)")
guard signalService.isCensorshipCircumventionActive else { guard signalService.isCensorshipCircumventionActive else {
@ -58,7 +59,9 @@ public class MessageFetcherJob: NSObject {
return promise return promise
} }
@objc public func run() -> AnyPromise { @objc
@discardableResult
public func run() -> AnyPromise {
return AnyPromise(run()) return AnyPromise(run())
} }

@ -138,8 +138,8 @@ NS_ASSUME_NONNULL_BEGIN
NSString *attachmentID = [userinfo objectForKey:kAttachmentUploadAttachmentIDKey]; NSString *attachmentID = [userinfo objectForKey:kAttachmentUploadAttachmentIDKey];
if ([self.attachment.uniqueId isEqual:attachmentID]) { if ([self.attachment.uniqueId isEqual:attachmentID]) {
if (!isnan(progress)) { if (!isnan(progress)) {
[self.progressView setProgress:progress]; [self.progressView setProgress:(CGFloat)progress];
self.lastProgress = progress; self.lastProgress = (CGFloat)progress;
self.isAttachmentReady = self.attachment.isUploaded; self.isAttachmentReady = self.attachment.isUploaded;
} else { } else {
OWSFail(@"%@ Invalid attachment progress.", self.logTag); OWSFail(@"%@ Invalid attachment progress.", self.logTag);

@ -67,7 +67,7 @@ NS_ASSUME_NONNULL_BEGIN
UIView *selectedBackgroundView = [UIView new]; UIView *selectedBackgroundView = [UIView new];
selectedBackgroundView.backgroundColor = selectedBackgroundView.backgroundColor =
[(UIColor.isThemeEnabled ? [UIColor ows_whiteColor] : [UIColor ows_blackColor]) colorWithAlphaComponent:0.08]; [(UIColor.isThemeEnabled ? [UIColor ows_whiteColor] : [UIColor ows_blackColor]) colorWithAlphaComponent:0.08f];
self.selectedBackgroundView = selectedBackgroundView; self.selectedBackgroundView = selectedBackgroundView;

@ -34,12 +34,14 @@ FOUNDATION_EXPORT const unsigned char SignalMessagingVersionString[];
#import <SignalMessaging/OWSQuotedReplyModel.h> #import <SignalMessaging/OWSQuotedReplyModel.h>
#import <SignalMessaging/OWSSounds.h> #import <SignalMessaging/OWSSounds.h>
#import <SignalMessaging/OWSTableViewController.h> #import <SignalMessaging/OWSTableViewController.h>
#import <SignalMessaging/OWSUnreadIndicator.h>
#import <SignalMessaging/OWSUserProfile.h> #import <SignalMessaging/OWSUserProfile.h>
#import <SignalMessaging/OWSWindowManager.h> #import <SignalMessaging/OWSWindowManager.h>
#import <SignalMessaging/Release.h> #import <SignalMessaging/Release.h>
#import <SignalMessaging/ScreenLockViewController.h> #import <SignalMessaging/ScreenLockViewController.h>
#import <SignalMessaging/SharingThreadPickerViewController.h> #import <SignalMessaging/SharingThreadPickerViewController.h>
#import <SignalMessaging/SignalKeyingStorage.h> #import <SignalMessaging/SignalKeyingStorage.h>
#import <SignalMessaging/TSUnreadIndicatorInteraction.h>
#import <SignalMessaging/ThreadUtil.h> #import <SignalMessaging/ThreadUtil.h>
#import <SignalMessaging/ThreadViewHelper.h> #import <SignalMessaging/ThreadViewHelper.h>
#import <SignalMessaging/UIColor+OWS.h> #import <SignalMessaging/UIColor+OWS.h>

@ -53,7 +53,7 @@ NSString *NSStringForScreenLockUIState(ScreenLockUIState value)
const CGSize screenSize = UIScreen.mainScreen.bounds.size; const CGSize screenSize = UIScreen.mainScreen.bounds.size;
const CGFloat shortScreenDimension = MIN(screenSize.width, screenSize.height); const CGFloat shortScreenDimension = MIN(screenSize.width, screenSize.height);
const CGFloat imageSize = round(shortScreenDimension / 3.f); const CGFloat imageSize = (CGFloat)round(shortScreenDimension / 3.f);
[imageView autoSetDimension:ALDimensionWidth toSize:imageSize]; [imageView autoSetDimension:ALDimensionWidth toSize:imageSize];
[imageView autoSetDimension:ALDimensionHeight toSize:imageSize]; [imageView autoSetDimension:ALDimensionHeight toSize:imageSize];

@ -2,8 +2,8 @@
// Copyright (c) 2018 Open Whisper Systems. All rights reserved. // Copyright (c) 2018 Open Whisper Systems. All rights reserved.
// //
#import "OWSMath.h"
#import "UIColor+OWS.h" #import "UIColor+OWS.h"
#import "OWSMath.h"
#import "UIUtil.h" #import "UIUtil.h"
#import <SignalServiceKit/Cryptography.h> #import <SignalServiceKit/Cryptography.h>
#import <SignalServiceKit/NSNotificationCenter+OWS.h> #import <SignalServiceKit/NSNotificationCenter+OWS.h>
@ -42,7 +42,7 @@ NSString *const UIColorKeyThemeEnabled = @"UIColorKeyThemeEnabled";
+ (UIColor *)ows_signalBrandBlueColor + (UIColor *)ows_signalBrandBlueColor
{ {
return [UIColor colorWithRed:0.1135657504 green:0.4787300229 blue:0.89595204589999999 alpha:1.]; return [UIColor colorWithRed:0.1135657504f green:0.4787300229f blue:0.89595204589999999f alpha:1.];
} }
+ (UIColor *)ows_materialBlueColor + (UIColor *)ows_materialBlueColor

@ -19,7 +19,7 @@ static const CGFloat kIPhone7PlusScreenWidth = 414.f;
CGFloat ScaleFromIPhone5To7Plus(CGFloat iPhone5Value, CGFloat iPhone7PlusValue) CGFloat ScaleFromIPhone5To7Plus(CGFloat iPhone5Value, CGFloat iPhone7PlusValue)
{ {
CGFloat screenShortDimension = ScreenShortDimension(); CGFloat screenShortDimension = ScreenShortDimension();
return round(CGFloatLerp(iPhone5Value, return (CGFloat)round(CGFloatLerp(iPhone5Value,
iPhone7PlusValue, iPhone7PlusValue,
CGFloatInverseLerp(screenShortDimension, kIPhone5ScreenWidth, kIPhone7PlusScreenWidth))); CGFloatInverseLerp(screenShortDimension, kIPhone5ScreenWidth, kIPhone7PlusScreenWidth)));
} }
@ -27,7 +27,7 @@ CGFloat ScaleFromIPhone5To7Plus(CGFloat iPhone5Value, CGFloat iPhone7PlusValue)
CGFloat ScaleFromIPhone5(CGFloat iPhone5Value) CGFloat ScaleFromIPhone5(CGFloat iPhone5Value)
{ {
CGFloat screenShortDimension = ScreenShortDimension(); CGFloat screenShortDimension = ScreenShortDimension();
return round(iPhone5Value * screenShortDimension / kIPhone5ScreenWidth); return (CGFloat)round(iPhone5Value * screenShortDimension / kIPhone5ScreenWidth);
} }
#pragma mark - #pragma mark -
@ -135,7 +135,7 @@ CGFloat ScaleFromIPhone5(CGFloat iPhone5Value)
- (NSLayoutConstraint *)autoPinToAspectRatio:(CGFloat)ratio - (NSLayoutConstraint *)autoPinToAspectRatio:(CGFloat)ratio
{ {
// Clamp to ensure view has reasonable aspect ratio. // Clamp to ensure view has reasonable aspect ratio.
CGFloat clampedRatio = CGFloatClamp(ratio, 0.05, 95.0); CGFloat clampedRatio = CGFloatClamp(ratio, 0.05f, 95.0f);
if (clampedRatio != ratio) { if (clampedRatio != ratio) {
OWSFail(@"Invalid aspect ratio: %f for view: %@", ratio, self); OWSFail(@"Invalid aspect ratio: %f for view: %@", ratio, self);
} }
@ -254,10 +254,9 @@ CGFloat ScaleFromIPhone5(CGFloat iPhone5Value)
{ {
OWSAssert(self.superview); OWSAssert(self.superview);
self.frame = CGRectMake(round((self.superview.width - self.width) * 0.5f), CGFloat x = (CGFloat)round((self.superview.width - self.width) * 0.5f);
round((self.superview.height - self.height) * 0.5f), CGFloat y = (CGFloat)round((self.superview.height - self.height) * 0.5f);
self.width, self.frame = CGRectMake(x, y, self.width, self.height);
self.height);
} }
#pragma mark - RTL #pragma mark - RTL

@ -332,7 +332,7 @@ NSString *const OWSContactsManagerSignalAccountsDidChangeNotification
NSMutableSet<NSString *> *seenRecipientIds = [NSMutableSet new]; NSMutableSet<NSString *> *seenRecipientIds = [NSMutableSet new];
for (Contact *contact in contacts) { for (Contact *contact in contacts) {
NSArray<SignalRecipient *> *signalRecipients = contactIdToSignalRecipientsMap[contact.uniqueId]; NSArray<SignalRecipient *> *signalRecipients = contactIdToSignalRecipientsMap[contact.uniqueId];
for (SignalRecipient *signalRecipient in [signalRecipients sortedArrayUsingSelector:@selector(compare:)]) { for (SignalRecipient *signalRecipient in [signalRecipients sortedArrayUsingSelector:@selector((compare:))]) {
if ([seenRecipientIds containsObject:signalRecipient.recipientId]) { if ([seenRecipientIds containsObject:signalRecipient.recipientId]) {
DDLogDebug(@"Ignoring duplicate contact: %@, %@", signalRecipient.recipientId, contact.fullName); DDLogDebug(@"Ignoring duplicate contact: %@, %@", signalRecipient.recipientId, contact.fullName);
continue; continue;

@ -1,5 +1,5 @@
// //
// Copyright (c) 2017 Open Whisper Systems. All rights reserved. // Copyright (c) 2018 Open Whisper Systems. All rights reserved.
// //
#import "OWS105AttachmentFilePaths.h" #import "OWS105AttachmentFilePaths.h"
@ -32,7 +32,7 @@ static NSString *const OWS105AttachmentFilePathsMigrationId = @"105";
[attachmentStreams addObject:attachmentStream]; [attachmentStreams addObject:attachmentStream];
}]; }];
DDLogInfo(@"Saving %zd attachment streams.", attachmentStreams.count); DDLogInfo(@"Saving %lu attachment streams.", (unsigned long)attachmentStreams.count);
// Persist the new localRelativeFilePath property of TSAttachmentStream. // Persist the new localRelativeFilePath property of TSAttachmentStream.
// For performance, we want to upgrade all existing attachment streams in // For performance, we want to upgrade all existing attachment streams in

@ -22,7 +22,7 @@ NS_ASSUME_NONNULL_BEGIN
NSMutableArray<NSString *> *recordIds = [NSMutableArray new]; NSMutableArray<NSString *> *recordIds = [NSMutableArray new];
[dbConnection asyncReadWriteWithBlock:^(YapDatabaseReadWriteTransaction *_Nonnull transaction) { [dbConnection asyncReadWriteWithBlock:^(YapDatabaseReadWriteTransaction *_Nonnull transaction) {
[recordIds addObjectsFromArray:[transaction allKeysInCollection:collection]]; [recordIds addObjectsFromArray:[transaction allKeysInCollection:collection]];
DDLogInfo(@"%@ Migrating %zd records from: %@.", self.logTag, recordIds.count, collection); DDLogInfo(@"%@ Migrating %lu records from: %@.", self.logTag, (unsigned long)recordIds.count, collection);
} }
completionQueue:dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0) completionQueue:dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)
completionBlock:^{ completionBlock:^{
@ -45,7 +45,7 @@ NS_ASSUME_NONNULL_BEGIN
OWSAssert(dbConnection); OWSAssert(dbConnection);
OWSAssert(completion); OWSAssert(completion);
DDLogVerbose(@"%@ %s: %zd", self.logTag, __PRETTY_FUNCTION__, recordIds.count); DDLogVerbose(@"%@ %s: %lu", self.logTag, __PRETTY_FUNCTION__, (unsigned long)recordIds.count);
if (recordIds.count < 1) { if (recordIds.count < 1) {
completion(); completion();

@ -531,14 +531,14 @@ const NSUInteger kOWSProfileManager_MaxAvatarDiameter = 640;
- (void)logProfileWhitelist - (void)logProfileWhitelist
{ {
[self.dbConnection asyncReadWithBlock:^(YapDatabaseReadTransaction *transaction) { [self.dbConnection asyncReadWithBlock:^(YapDatabaseReadTransaction *transaction) {
DDLogError(@"kOWSProfileManager_UserWhitelistCollection: %zd", DDLogError(@"kOWSProfileManager_UserWhitelistCollection: %lu",
[transaction numberOfKeysInCollection:kOWSProfileManager_UserWhitelistCollection]); (unsigned long)[transaction numberOfKeysInCollection:kOWSProfileManager_UserWhitelistCollection]);
[transaction enumerateKeysInCollection:kOWSProfileManager_UserWhitelistCollection [transaction enumerateKeysInCollection:kOWSProfileManager_UserWhitelistCollection
usingBlock:^(NSString *_Nonnull key, BOOL *_Nonnull stop) { usingBlock:^(NSString *_Nonnull key, BOOL *_Nonnull stop) {
DDLogError(@"\t profile whitelist user: %@", key); DDLogError(@"\t profile whitelist user: %@", key);
}]; }];
DDLogError(@"kOWSProfileManager_GroupWhitelistCollection: %zd", DDLogError(@"kOWSProfileManager_GroupWhitelistCollection: %lu",
[transaction numberOfKeysInCollection:kOWSProfileManager_GroupWhitelistCollection]); (unsigned long)[transaction numberOfKeysInCollection:kOWSProfileManager_GroupWhitelistCollection]);
[transaction enumerateKeysInCollection:kOWSProfileManager_GroupWhitelistCollection [transaction enumerateKeysInCollection:kOWSProfileManager_GroupWhitelistCollection
usingBlock:^(NSString *_Nonnull key, BOOL *_Nonnull stop) { usingBlock:^(NSString *_Nonnull key, BOOL *_Nonnull stop) {
DDLogError(@"\t profile whitelist group: %@", key); DDLogError(@"\t profile whitelist group: %@", key);

@ -330,11 +330,11 @@ NSString *const kLocalProfileUniqueId = @"kLocalProfileUniqueId";
// This should only be used in verbose, developer-only logs. // This should only be used in verbose, developer-only logs.
- (NSString *)debugDescription - (NSString *)debugDescription
{ {
return [NSString stringWithFormat:@"%@ %p %@ %zd %@ %@ %@", return [NSString stringWithFormat:@"%@ %p %@ %lu %@ %@ %@",
self.logTag, self.logTag,
self, self,
self.recipientId, self.recipientId,
self.profileKey.keyData.length, (unsigned long)self.profileKey.keyData.length,
self.profileName, self.profileName,
self.avatarUrlPath, self.avatarUrlPath,
self.avatarFileName]; self.avatarFileName];

@ -155,7 +155,7 @@ NS_ASSUME_NONNULL_BEGIN
self.delegate.audioPlaybackState = AudioPlaybackState_Paused; self.delegate.audioPlaybackState = AudioPlaybackState_Paused;
[self.audioPlayer pause]; [self.audioPlayer pause];
[self.audioPlayerPoller invalidate]; [self.audioPlayerPoller invalidate];
[self.delegate setAudioProgress:[self.audioPlayer currentTime] duration:[self.audioPlayer duration]]; [self.delegate setAudioProgress:(CGFloat)[self.audioPlayer currentTime] duration:(CGFloat)[self.audioPlayer duration]];
[OWSAudioSession.shared endAudioActivity:self.audioActivity]; [OWSAudioSession.shared endAudioActivity:self.audioActivity];
[DeviceSleepManager.sharedInstance removeBlockWithBlockObject:self]; [DeviceSleepManager.sharedInstance removeBlockWithBlockObject:self];
@ -194,7 +194,7 @@ NS_ASSUME_NONNULL_BEGIN
OWSAssert(self.audioPlayer); OWSAssert(self.audioPlayer);
OWSAssert(self.audioPlayerPoller); OWSAssert(self.audioPlayerPoller);
[self.delegate setAudioProgress:[self.audioPlayer currentTime] duration:[self.audioPlayer duration]]; [self.delegate setAudioProgress:(CGFloat)[self.audioPlayer currentTime] duration:(CGFloat)[self.audioPlayer duration]];
} }
- (void)audioPlayerDidFinishPlaying:(AVAudioPlayer *)player successfully:(BOOL)flag - (void)audioPlayerDidFinishPlaying:(AVAudioPlayer *)player successfully:(BOOL)flag

@ -124,7 +124,7 @@ NS_ASSUME_NONNULL_BEGIN
[initials appendString:@"#"]; [initials appendString:@"#"];
} }
CGFloat fontSize = (CGFloat)self.diameter / 2.8; CGFloat fontSize = (CGFloat)self.diameter / 2.8f;
UIImage *image = [[JSQMessagesAvatarImageFactory avatarImageWithUserInitials:initials UIImage *image = [[JSQMessagesAvatarImageFactory avatarImageWithUserInitials:initials
backgroundColor:self.color backgroundColor:self.color

@ -30,7 +30,7 @@ static inline CGFloat CGFloatInverseLerp(CGFloat value, CGFloat minValue, CGFloa
// Ceil to an even number // Ceil to an even number
static inline CGFloat CeilEven(CGFloat value) static inline CGFloat CeilEven(CGFloat value)
{ {
return 2.f * ceil(value * 0.5f); return 2.f * (CGFloat)ceil(value * 0.5f);
} }
void SetRandFunctionSeed(void); void SetRandFunctionSeed(void);

@ -731,7 +731,7 @@ NS_ASSUME_NONNULL_BEGIN
OWSProdLogAndFail(@"%@ couldn't load uniqueIds for collection: %@.", self.logTag, collection); OWSProdLogAndFail(@"%@ couldn't load uniqueIds for collection: %@.", self.logTag, collection);
return; return;
} }
DDLogInfo(@"%@ Deleting %zd objects from: %@", self.logTag, uniqueIds.count, collection); DDLogInfo(@"%@ Deleting %lu objects from: %@", self.logTag, (unsigned long)uniqueIds.count, collection);
NSUInteger count = 0; NSUInteger count = 0;
for (NSString *uniqueId in uniqueIds) { for (NSString *uniqueId in uniqueIds) {
// We need to fetch each object, since [TSYapDatabaseObject removeWithTransaction:] sometimes does important // We need to fetch each object, since [TSYapDatabaseObject removeWithTransaction:] sometimes does important
@ -744,7 +744,7 @@ NS_ASSUME_NONNULL_BEGIN
[object removeWithTransaction:transaction]; [object removeWithTransaction:transaction];
count++; count++;
}; };
DDLogInfo(@"%@ Deleted %zd/%zd objects from: %@", self.logTag, count, uniqueIds.count, collection); DDLogInfo(@"%@ Deleted %lu/%lu objects from: %@", self.logTag, (unsigned long)count, (unsigned long)uniqueIds.count, collection);
} }
#pragma mark - Find Content #pragma mark - Find Content

@ -414,7 +414,7 @@ NSString *const TSAccountManager_ServerSignalingKey = @"TSStorageServerSignaling
case 423: { case 423: {
NSString *localizedMessage = NSLocalizedString(@"REGISTRATION_VERIFICATION_FAILED_WRONG_PIN", NSString *localizedMessage = NSLocalizedString(@"REGISTRATION_VERIFICATION_FAILED_WRONG_PIN",
"Error message indicating that registration failed due to a missing or incorrect 2FA PIN."); "Error message indicating that registration failed due to a missing or incorrect 2FA PIN.");
DDLogError(@"%@ 2FA PIN required: %ld", self.logTag, error.code); DDLogError(@"%@ 2FA PIN required: %ld", self.logTag, (long)error.code);
NSError *error NSError *error
= OWSErrorWithCodeDescription(OWSErrorCodeRegistrationMissing2FAPIN, localizedMessage); = OWSErrorWithCodeDescription(OWSErrorCodeRegistrationMissing2FAPIN, localizedMessage);
failureBlock(error); failureBlock(error);

@ -85,7 +85,7 @@ NS_ASSUME_NONNULL_BEGIN
- (NSString *)debugDescription - (NSString *)debugDescription
{ {
return [NSString stringWithFormat:@"%@ with message timestamps: %zd", self.logTag, self.messageTimestamps.count]; return [NSString stringWithFormat:@"%@ with message timestamps: %lu", self.logTag, (unsigned long)self.messageTimestamps.count];
} }
@end @end

@ -36,23 +36,23 @@ typedef NS_ENUM(int32_t, TSErrorMessageType) {
quotedMessage:(nullable TSQuotedMessage *)quotedMessage quotedMessage:(nullable TSQuotedMessage *)quotedMessage
contactShare:(nullable OWSContact *)contact NS_UNAVAILABLE; contactShare:(nullable OWSContact *)contact NS_UNAVAILABLE;
- (instancetype)initWithTimestamp:(uint64_t)timestamp
inThread:(nullable TSThread *)thread
messageBody:(nullable NSString *)body
attachmentIds:(NSArray<NSString *> *)attachmentIds
expiresInSeconds:(uint32_t)expiresInSeconds
expireStartedAt:(uint64_t)expireStartedAt NS_UNAVAILABLE;
- (nullable instancetype)initWithCoder:(NSCoder *)coder NS_DESIGNATED_INITIALIZER; - (nullable instancetype)initWithCoder:(NSCoder *)coder NS_DESIGNATED_INITIALIZER;
- (instancetype)initWithTimestamp:(uint64_t)timestamp - (instancetype)initWithTimestamp:(uint64_t)timestamp
inThread:(TSThread *)thread inThread:(nullable TSThread *)thread
failedMessageType:(TSErrorMessageType)errorMessageType failedMessageType:(TSErrorMessageType)errorMessageType
recipientId:(nullable NSString *)recipientId NS_DESIGNATED_INITIALIZER; recipientId:(nullable NSString *)recipientId NS_DESIGNATED_INITIALIZER;
- (instancetype)initWithTimestamp:(uint64_t)timestamp
inThread:(TSThread *)thread
failedMessageType:(TSErrorMessageType)errorMessageType;
- (instancetype)initWithTimestamp:(uint64_t)timestamp - (instancetype)initWithTimestamp:(uint64_t)timestamp
inThread:(nullable TSThread *)thread inThread:(nullable TSThread *)thread
messageBody:(nullable NSString *)body failedMessageType:(TSErrorMessageType)errorMessageType;
attachmentIds:(NSArray<NSString *> *)attachmentIds
expiresInSeconds:(uint32_t)expiresInSeconds
expireStartedAt:(uint64_t)expireStartedAt NS_UNAVAILABLE;
+ (instancetype)corruptedMessageWithEnvelope:(OWSSignalServiceProtosEnvelope *)envelope + (instancetype)corruptedMessageWithEnvelope:(OWSSignalServiceProtosEnvelope *)envelope
withTransaction:(YapDatabaseReadWriteTransaction *)transaction; withTransaction:(YapDatabaseReadWriteTransaction *)transaction;

@ -48,14 +48,7 @@ NSUInteger TSErrorMessageSchemaVersion = 1;
} }
- (instancetype)initWithTimestamp:(uint64_t)timestamp - (instancetype)initWithTimestamp:(uint64_t)timestamp
inThread:(TSThread *)thread inThread:(nullable TSThread *)thread
failedMessageType:(TSErrorMessageType)errorMessageType
{
return [self initWithTimestamp:timestamp inThread:thread failedMessageType:errorMessageType recipientId:nil];
}
- (instancetype)initWithTimestamp:(uint64_t)timestamp
inThread:(TSThread *)thread
failedMessageType:(TSErrorMessageType)errorMessageType failedMessageType:(TSErrorMessageType)errorMessageType
recipientId:(nullable NSString *)recipientId recipientId:(nullable NSString *)recipientId
{ {
@ -83,6 +76,13 @@ NSUInteger TSErrorMessageSchemaVersion = 1;
return self; return self;
} }
- (instancetype)initWithTimestamp:(uint64_t)timestamp
inThread:(nullable TSThread *)thread
failedMessageType:(TSErrorMessageType)errorMessageType
{
return [self initWithTimestamp:timestamp inThread:thread failedMessageType:errorMessageType recipientId:nil];
}
- (instancetype)initWithEnvelope:(OWSSignalServiceProtosEnvelope *)envelope - (instancetype)initWithEnvelope:(OWSSignalServiceProtosEnvelope *)envelope
withTransaction:(YapDatabaseReadWriteTransaction *)transaction withTransaction:(YapDatabaseReadWriteTransaction *)transaction
failedMessageType:(TSErrorMessageType)errorMessageType failedMessageType:(TSErrorMessageType)errorMessageType

@ -356,11 +356,11 @@ NSString *const OWSMessageContentJobFinderExtensionGroup = @"OWSMessageContentJo
backgroundTask = nil; backgroundTask = nil;
DDLogVerbose(@"%@ completed %lu/%lu jobs. %zd jobs left.", DDLogVerbose(@"%@ completed %lu/%lu jobs. %lu jobs left.",
self.logTag, self.logTag,
(unsigned long)processedJobs.count, (unsigned long)processedJobs.count,
(unsigned long)batchJobs.count, (unsigned long)batchJobs.count,
[OWSMessageContentJob numberOfKeysInCollection]); (unsigned long)[OWSMessageContentJob numberOfKeysInCollection]);
// Wait a bit in hopes of increasing the batch size. // Wait a bit in hopes of increasing the batch size.
// This delay won't affect the first message to arrive when this queue is idle, // This delay won't affect the first message to arrive when this queue is idle,

@ -257,9 +257,9 @@ NS_ASSUME_NONNULL_BEGIN
DDLogInfo(@"%@ Missing message for delivery receipt: %llu", self.logTag, timestamp); DDLogInfo(@"%@ Missing message for delivery receipt: %llu", self.logTag, timestamp);
} else { } else {
if (messages.count > 1) { if (messages.count > 1) {
DDLogInfo(@"%@ More than one message (%zd) for delivery receipt: %llu", DDLogInfo(@"%@ More than one message (%lu) for delivery receipt: %llu",
self.logTag, self.logTag,
messages.count, (unsigned long)messages.count,
timestamp); timestamp);
} }
for (TSOutgoingMessage *outgoingMessage in messages) { for (TSOutgoingMessage *outgoingMessage in messages) {

@ -226,9 +226,9 @@ NSString *const OWSReadReceiptManagerAreReadReceiptsEnabled = @"areReadReceiptsE
[self.messageSender enqueueMessage:message [self.messageSender enqueueMessage:message
success:^{ success:^{
DDLogInfo(@"%@ Successfully sent %zd read receipt to linked devices.", DDLogInfo(@"%@ Successfully sent %lu read receipt to linked devices.",
self.logTag, self.logTag,
readReceiptsForLinkedDevices.count); (unsigned long)readReceiptsForLinkedDevices.count);
} }
failure:^(NSError *error) { failure:^(NSError *error) {
DDLogError(@"%@ Failed to send read receipt to linked devices with error: %@", self.logTag, error); DDLogError(@"%@ Failed to send read receipt to linked devices with error: %@", self.logTag, error);
@ -250,7 +250,7 @@ NSString *const OWSReadReceiptManagerAreReadReceiptsEnabled = @"areReadReceiptsE
[self.messageSender enqueueMessage:message [self.messageSender enqueueMessage:message
success:^{ success:^{
DDLogInfo(@"%@ Successfully sent %zd read receipts to sender.", self.logTag, timestamps.count); DDLogInfo(@"%@ Successfully sent %lu read receipts to sender.", self.logTag, (unsigned long)timestamps.count);
} }
failure:^(NSError *error) { failure:^(NSError *error) {
DDLogError(@"%@ Failed to send read receipts to sender with error: %@", self.logTag, error); DDLogError(@"%@ Failed to send read receipts to sender with error: %@", self.logTag, error);

@ -202,7 +202,7 @@ typedef void (^failureBlock)(NSURLSessionDataTask *task, NSError *error);
break; break;
} }
case 411: { case 411: {
DDLogInfo(@"Multi-device pairing: %zd, %@, %@", statusCode, networkError.debugDescription, request); DDLogInfo(@"Multi-device pairing: %ld, %@, %@", (long)statusCode, networkError.debugDescription, request);
failureBlock(task, failureBlock(task,
[self errorWithHTTPCode:statusCode [self errorWithHTTPCode:statusCode
description:NSLocalizedString(@"MULTIDEVICE_PAIRING_MAX_DESC", nil) description:NSLocalizedString(@"MULTIDEVICE_PAIRING_MAX_DESC", nil)
@ -239,7 +239,7 @@ typedef void (^failureBlock)(NSURLSessionDataTask *task, NSError *error);
break; break;
} }
default: { default: {
DDLogWarn(@"Unknown error: %zd, %@, %@", statusCode, networkError.debugDescription, request); DDLogWarn(@"Unknown error: %ld, %@, %@", (long)statusCode, networkError.debugDescription, request);
failureBlock(task, error); failureBlock(task, error);
break; break;
} }

@ -584,8 +584,7 @@ NSString *const kNSNotification_SocketManagerStateDidChange = @"kNSNotification_
if (message.hasBody) { if (message.hasBody) {
responseData = message.body; responseData = message.body;
} }
NSArray<NSString *> *_Nullable responseHeaders = message.headers;
BOOL hasValidResponse = YES; BOOL hasValidResponse = YES;
id responseObject = responseData; id responseObject = responseData;
if (responseData) { if (responseData) {

@ -1,9 +1,10 @@
// Copyright © 2016 Open Whisper Systems. All rights reserved. //
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
//
#import "OWSWebsocketSecurityPolicy.h" #import "OWSWebsocketSecurityPolicy.h"
#import <SocketRocket/SRSecurityPolicy.h>
#import "OWSHTTPSecurityPolicy.h" #import "OWSHTTPSecurityPolicy.h"
#import <SocketRocket/SRSecurityPolicy.h>
@implementation OWSWebsocketSecurityPolicy @implementation OWSWebsocketSecurityPolicy
@ -11,7 +12,11 @@
static OWSWebsocketSecurityPolicy *websocketSecurityPolicy = nil; static OWSWebsocketSecurityPolicy *websocketSecurityPolicy = nil;
static dispatch_once_t onceToken; static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{ dispatch_once(&onceToken, ^{
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
// We use our own CA
websocketSecurityPolicy = [[self alloc] initWithCertificateChainValidationEnabled:NO]; websocketSecurityPolicy = [[self alloc] initWithCertificateChainValidationEnabled:NO];
#pragma clang diagnostic pop
}); });
return websocketSecurityPolicy; return websocketSecurityPolicy;
} }

@ -2,8 +2,8 @@
// Copyright (c) 2018 Open Whisper Systems. All rights reserved. // Copyright (c) 2018 Open Whisper Systems. All rights reserved.
// //
#import "OWSFileSystem.h"
#import "OWSPrimaryStorage+SessionStore.h" #import "OWSPrimaryStorage+SessionStore.h"
#import "OWSFileSystem.h"
#import "YapDatabaseConnection+OWS.h" #import "YapDatabaseConnection+OWS.h"
#import "YapDatabaseTransaction+OWS.h" #import "YapDatabaseTransaction+OWS.h"
#import <AxolotlKit/SessionRecord.h> #import <AxolotlKit/SessionRecord.h>
@ -66,6 +66,8 @@ NSString *const kSessionStoreDBConnectionKey = @"kSessionStoreDBConnectionKey";
return record; return record;
} }
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
- (NSArray *)subDevicesSessions:(NSString *)contactIdentifier protocolContext:(nullable id)protocolContext - (NSArray *)subDevicesSessions:(NSString *)contactIdentifier protocolContext:(nullable id)protocolContext
{ {
OWSAssert(contactIdentifier.length > 0); OWSAssert(contactIdentifier.length > 0);
@ -82,6 +84,7 @@ NSString *const kSessionStoreDBConnectionKey = @"kSessionStoreDBConnectionKey";
return dictionary ? dictionary.allKeys : @[]; return dictionary ? dictionary.allKeys : @[];
} }
#pragma clang diagnostic pop
- (void)storeSession:(NSString *)contactIdentifier - (void)storeSession:(NSString *)contactIdentifier
deviceId:(int)deviceId deviceId:(int)deviceId

@ -213,7 +213,7 @@ NS_ASSUME_NONNULL_BEGIN
} else if (range.location != index || range.length < 1) { } else if (range.location != index || range.length < 1) {
// This should never happen. // This should never happen.
OWSFail( OWSFail(
@"%@ unexpected composed character sequence: %zd, %@", self.logTag, index, NSStringFromRange(range)); @"%@ unexpected composed character sequence: %lu, %@", self.logTag, (unsigned long)index, NSStringFromRange(range));
return YES; return YES;
} }
index = range.location + range.length; index = range.location + range.length;

@ -266,10 +266,10 @@ NSString *NSStringForOWSAnalyticsSeverity(OWSAnalyticsSeverity severity)
static dispatch_once_t onceToken; static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{ dispatch_once(&onceToken, ^{
NSOperatingSystemVersion operatingSystemVersion = [[NSProcessInfo processInfo] operatingSystemVersion]; NSOperatingSystemVersion operatingSystemVersion = [[NSProcessInfo processInfo] operatingSystemVersion];
result = [NSString stringWithFormat:@"%zd.%zd.%zd", result = [NSString stringWithFormat:@"%lu.%lu.%lu",
(NSUInteger)operatingSystemVersion.majorVersion, (unsigned long)operatingSystemVersion.majorVersion,
(NSUInteger)operatingSystemVersion.minorVersion, (unsigned long)operatingSystemVersion.minorVersion,
(NSUInteger)operatingSystemVersion.patchVersion]; (unsigned long)operatingSystemVersion.patchVersion];
}); });
return result; return result;
} }

@ -98,12 +98,12 @@ NSString *const OWSOperationKeyIsFinished = @"isFinished";
- (void)reportError:(NSError *)error - (void)reportError:(NSError *)error
{ {
DDLogDebug(@"%@ reportError: %@, fatal?: %d, retryable?: %d, remainingRetries: %zd", DDLogDebug(@"%@ reportError: %@, fatal?: %d, retryable?: %d, remainingRetries: %lu",
self.logTag, self.logTag,
error, error,
error.isFatal, error.isFatal,
error.isRetryable, error.isRetryable,
self.remainingRetries); (unsigned long)self.remainingRetries);
if (error.isFatal) { if (error.isFatal) {
[self failOperationWithError:error]; [self failOperationWithError:error];

Loading…
Cancel
Save