Fix some project warnings + other fixes

- Prefer checking `.isEmpty` rather than `.count == 0` for Swift collections (can be more optimal)
- Avoid comparing `BOOL` explicitly to `NO` (considered bad practice since `BOOL` is a `signed char`)
- Specify unused `SGX_FLAGS` as `__unused` to silence warnings
This commit is contained in:
Jesse Squires 2018-07-29 20:13:00 -07:00 committed by Michael Kirk
parent a0b8016bcc
commit 6dc74ddcaf
5 changed files with 8 additions and 8 deletions

View File

@ -328,7 +328,7 @@ public class ContactsPicker: OWSViewController, UITableViewDelegate, UITableView
open func updateSearchResults(searchText: String) {
let predicate: NSPredicate
if searchText.count == 0 {
if searchText.isEmpty {
filteredSections = sections
} else {
do {

View File

@ -4013,7 +4013,7 @@ typedef enum : NSUInteger {
- (void)saveDraft
{
if (self.inputToolbar.hidden == NO) {
if (!self.inputToolbar.hidden) {
__block TSThread *thread = _thread;
__block NSString *currentDraft = [self.inputToolbar messageText];

View File

@ -362,7 +362,7 @@ class MessageDetailViewController: OWSViewController, MediaGalleryDataSourceDele
self.messageBubbleViewHeightLayoutConstraint = messageBubbleView.autoSetDimension(.height, toSize: 0)
rows.append(row)
if rows.count == 0 {
if rows.isEmpty {
// Neither attachment nor body.
owsFail("\(self.logTag) Message has neither attachment nor body.")
rows.append(valueRow(name: NSLocalizedString("MESSAGE_METADATA_VIEW_NO_ATTACHMENT_OR_BODY",

View File

@ -141,7 +141,7 @@ public class OWSAudioSession: NSObject {
return oldActivity
}
guard currentActivities.count == 0 else {
guard currentActivities.isEmpty else {
Logger.debug("\(logTag) not deactivating due to currentActivities: \(currentActivities)")
return
}

View File

@ -10,11 +10,11 @@ NS_ASSUME_NONNULL_BEGIN
static const long SGX_FLAGS_INITTED = 0x0000000000000001L;
static const long SGX_FLAGS_DEBUG = 0x0000000000000002L;
static const long SGX_FLAGS_MODE64BIT = 0x0000000000000004L;
static const long SGX_FLAGS_PROVISION_KEY = 0x0000000000000004L;
static const long SGX_FLAGS_EINITTOKEN_KEY = 0x0000000000000004L;
static const long __unused SGX_FLAGS_PROVISION_KEY = 0x0000000000000004L;
static const long __unused SGX_FLAGS_EINITTOKEN_KEY = 0x0000000000000004L;
static const long SGX_FLAGS_RESERVED = 0xFFFFFFFFFFFFFFC8L;
static const long SGX_XFRM_LEGACY = 0x0000000000000003L;
static const long SGX_XFRM_AVX = 0x0000000000000006L;
static const long __unused SGX_XFRM_LEGACY = 0x0000000000000003L;
static const long __unused SGX_XFRM_AVX = 0x0000000000000006L;
static const long SGX_XFRM_RESERVED = 0xFFFFFFFFFFFFFFF8L;
#pragma mark -