Miscellaneous warnings fixed

This commit is contained in:
Murat Baysangurov
2017-07-23 21:02:21 +03:00
parent 404560f029
commit 02531ea7be
21 changed files with 59 additions and 66 deletions

View File

@@ -86,7 +86,10 @@ static inline CTTextAlignment CTTextAlignmentFromBITTextAlignment(BITTextAlignme
case NSTextAlignmentLeft: return kCTLeftTextAlignment;
case NSTextAlignmentCenter: return kCTCenterTextAlignment;
case NSTextAlignmentRight: return kCTRightTextAlignment;
default: return kCTNaturalTextAlignment;
case BITTextAlignmentJustified:
case BITTextAlignmentNatural:
default:
return kCTNaturalTextAlignment;
}
#else
switch (alignment) {
@@ -170,6 +173,8 @@ static inline CGFloat BITFlushFactorForTextAlignment(NSTextAlignment textAlignme
case BITTextAlignmentRight:
return 1.0;
case BITTextAlignmentLeft:
case BITTextAlignmentJustified:
case BITTextAlignmentNatural:
default:
return 0.0;
}
@@ -179,9 +184,9 @@ static inline NSDictionary * NSAttributedStringAttributesFromLabel(BITAttributed
NSMutableDictionary *mutableAttributes = [NSMutableDictionary dictionary];
if ([NSMutableParagraphStyle class]) {
[mutableAttributes setObject:label.font forKey:(NSString *)kCTFontAttributeName];
[mutableAttributes setObject:label.textColor forKey:(NSString *)kCTForegroundColorAttributeName];
[mutableAttributes setObject:@(label.kern) forKey:(NSString *)kCTKernAttributeName];
[mutableAttributes setObject:label.font forKey:(const NSString *)kCTFontAttributeName];
[mutableAttributes setObject:label.textColor forKey:(const NSString *)kCTForegroundColorAttributeName];
[mutableAttributes setObject:@(label.kern) forKey:(const NSString *)kCTKernAttributeName];
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
paragraphStyle.alignment = label.textAlignment;
@@ -197,14 +202,14 @@ static inline NSDictionary * NSAttributedStringAttributesFromLabel(BITAttributed
paragraphStyle.lineBreakMode = NSLineBreakByWordWrapping;
}
[mutableAttributes setObject:paragraphStyle forKey:(NSString *)kCTParagraphStyleAttributeName];
[mutableAttributes setObject:paragraphStyle forKey:(const NSString *)kCTParagraphStyleAttributeName];
} else {
CTFontRef font = CTFontCreateWithName((__bridge CFStringRef)label.font.fontName, label.font.pointSize, NULL);
[mutableAttributes setObject:(__bridge id)font forKey:(NSString *)kCTFontAttributeName];
[mutableAttributes setObject:(__bridge id)font forKey:(const NSString *)kCTFontAttributeName];
CFRelease(font);
[mutableAttributes setObject:(id)[label.textColor CGColor] forKey:(NSString *)kCTForegroundColorAttributeName];
[mutableAttributes setObject:@(label.kern) forKey:(NSString *)kCTKernAttributeName];
[mutableAttributes setObject:(id)[label.textColor CGColor] forKey:(const NSString *)kCTForegroundColorAttributeName];
[mutableAttributes setObject:@(label.kern) forKey:(const NSString *)kCTKernAttributeName];
CTTextAlignment alignment = CTTextAlignmentFromBITTextAlignment(label.textAlignment);
CGFloat lineSpacing = label.lineSpacing;
@@ -232,7 +237,7 @@ static inline NSDictionary * NSAttributedStringAttributesFromLabel(BITAttributed
CTParagraphStyleRef paragraphStyle = CTParagraphStyleCreate(paragraphStyles, 12);
[mutableAttributes setObject:(__bridge id)paragraphStyle forKey:(NSString *)kCTParagraphStyleAttributeName];
[mutableAttributes setObject:(__bridge id)paragraphStyle forKey:(const NSString *)kCTParagraphStyleAttributeName];
CFRelease(paragraphStyle);
}
@@ -275,7 +280,7 @@ static inline NSAttributedString * NSAttributedStringBySettingColorFromContext(N
[mutableAttributedString enumerateAttribute:(NSString *)kCTForegroundColorFromContextAttributeName inRange:NSMakeRange(0, [mutableAttributedString length]) options:0 usingBlock:^(id value, NSRange range, __unused BOOL *stop) {
BOOL usesColorFromContext = (BOOL)value;
if (usesColorFromContext) {
[mutableAttributedString setAttributes:[NSDictionary dictionaryWithObject:color forKey:(NSString *)kCTForegroundColorAttributeName] range:range];
[mutableAttributedString setAttributes:[NSDictionary dictionaryWithObject:color forKey:(const NSString *)kCTForegroundColorAttributeName] range:range];
[mutableAttributedString removeAttribute:(NSString *)kCTForegroundColorFromContextAttributeName range:range];
}
}];
@@ -394,22 +399,22 @@ static inline CGSize CTFramesetterSuggestFrameSizeForAttributedStringWithConstra
self.linkBackgroundEdgeInset = UIEdgeInsetsMake(0.0, -1.0, 0.0, -1.0);
NSMutableDictionary *mutableLinkAttributes = [NSMutableDictionary dictionary];
[mutableLinkAttributes setObject:[NSNumber numberWithBool:YES] forKey:(NSString *)kCTUnderlineStyleAttributeName];
[mutableLinkAttributes setObject:[NSNumber numberWithBool:YES] forKey:(const NSString *)kCTUnderlineStyleAttributeName];
NSMutableDictionary *mutableActiveLinkAttributes = [NSMutableDictionary dictionary];
[mutableActiveLinkAttributes setObject:[NSNumber numberWithBool:NO] forKey:(NSString *)kCTUnderlineStyleAttributeName];
[mutableActiveLinkAttributes setObject:[NSNumber numberWithBool:NO] forKey:(const NSString *)kCTUnderlineStyleAttributeName];
NSMutableDictionary *mutableInactiveLinkAttributes = [NSMutableDictionary dictionary];
[mutableInactiveLinkAttributes setObject:[NSNumber numberWithBool:NO] forKey:(NSString *)kCTUnderlineStyleAttributeName];
[mutableInactiveLinkAttributes setObject:[NSNumber numberWithBool:NO] forKey:(const NSString *)kCTUnderlineStyleAttributeName];
if ([NSMutableParagraphStyle class]) {
[mutableLinkAttributes setObject:[UIColor blueColor] forKey:(NSString *)kCTForegroundColorAttributeName];
[mutableActiveLinkAttributes setObject:[UIColor redColor] forKey:(NSString *)kCTForegroundColorAttributeName];
[mutableInactiveLinkAttributes setObject:[UIColor grayColor] forKey:(NSString *)kCTForegroundColorAttributeName];
[mutableLinkAttributes setObject:[UIColor blueColor] forKey:(const NSString *)kCTForegroundColorAttributeName];
[mutableActiveLinkAttributes setObject:[UIColor redColor] forKey:(const NSString *)kCTForegroundColorAttributeName];
[mutableInactiveLinkAttributes setObject:[UIColor grayColor] forKey:(const NSString *)kCTForegroundColorAttributeName];
} else {
[mutableLinkAttributes setObject:(__bridge id)[[UIColor blueColor] CGColor] forKey:(NSString *)kCTForegroundColorAttributeName];
[mutableActiveLinkAttributes setObject:(__bridge id)[[UIColor redColor] CGColor] forKey:(NSString *)kCTForegroundColorAttributeName];
[mutableInactiveLinkAttributes setObject:(__bridge id)[[UIColor grayColor] CGColor] forKey:(NSString *)kCTForegroundColorAttributeName];
[mutableLinkAttributes setObject:(__bridge id)[[UIColor blueColor] CGColor] forKey:(const NSString *)kCTForegroundColorAttributeName];
[mutableActiveLinkAttributes setObject:(__bridge id)[[UIColor redColor] CGColor] forKey:(const NSString *)kCTForegroundColorAttributeName];
[mutableInactiveLinkAttributes setObject:(__bridge id)[[UIColor grayColor] CGColor] forKey:(const NSString *)kCTForegroundColorAttributeName];
}
self.linkAttributes = [NSDictionary dictionaryWithDictionary:mutableLinkAttributes];
@@ -709,7 +714,7 @@ static inline CGSize CTFramesetterSuggestFrameSizeForAttributedStringWithConstra
BITAttributedLabelLink *link = nil;
for (NSInteger i = 0; i < count && link.result == nil; i ++) {
for (size_t i = 0; i < count && link.result == nil; i ++) {
CGPoint currentPoint = CGPointMake(point.x + deltas[i].x, point.y + deltas[i].y);
link = [self linkAtCharacterIndex:[self characterIndexAtPoint:currentPoint]];
}

View File

@@ -143,8 +143,8 @@
}
#pragma mark - UIViewController Rotation
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) __unused orientation {
return YES;
-(UIInterfaceOrientationMask)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskAll;
}
#pragma mark - Private methods

View File

@@ -171,7 +171,6 @@ static unsigned char kBITPNGEndChunk[4] = {0x49, 0x45, 0x4e, 0x44};
self.identified = YES;
if (completion) { completion(YES, nil); }
return;
break;
case BITAuthenticatorIdentificationTypeHockeyAppUser:
viewController = [[BITAuthenticationViewController alloc] initWithDelegate:self];
viewController.requirePassword = YES;
@@ -680,7 +679,6 @@ static unsigned char kBITPNGEndChunk[4] = {0x49, 0x45, 0x4e, 0x44};
case BITAuthenticatorIdentificationTypeHockeyAppEmail:
case BITAuthenticatorIdentificationTypeHockeyAppUser:
return nil;
break;
}
NSURL *url = [self.webpageURL URLByAppendingPathComponent:[NSString stringWithFormat:@"apps/%@/authorize", self.encodedAppIdentifier]];
NSParameterAssert(whatParameter && url.absoluteString);

View File

@@ -41,7 +41,7 @@ NS_ASSUME_NONNULL_BEGIN
#pragma mark - Initialisation
- (instancetype)init {
if (self = [super init]) {
if ((self = [super init])) {
bit_resetSafeJsonStream(&BITSafeJsonEventsString);
_dataItemCount = 0;
if (bit_isDebuggerAttached()) {
@@ -60,7 +60,7 @@ NS_ASSUME_NONNULL_BEGIN
}
- (instancetype)initWithTelemetryContext:(BITTelemetryContext *)telemetryContext persistence:(BITPersistence *)persistence {
if (self = [self init]) {
if ((self = [self init])) {
_telemetryContext = telemetryContext;
_persistence = persistence;
}

View File

@@ -177,7 +177,7 @@ static PLCrashReporterCallbacks plCrashCallbacks = {
// C++ Exception Handler
static void uncaught_cxx_exception_handler(const BITCrashUncaughtCXXExceptionInfo *info) {
static void uncaught_cxx_exception_handler(const BITCrashUncaughtCXXExceptionInfo *info) {
// This relies on a LOT of sneaky internal knowledge of how PLCR works and should not be considered a long-term solution.
NSGetUncaughtExceptionHandler()([[BITCrashCXXExceptionWrapperException alloc] initWithCXXExceptionInfo:info]);
abort();

View File

@@ -7,7 +7,7 @@
/// Initializes a new instance of the class.
- (instancetype)init {
if (self = [super init]) {
if ((self = [super init])) {
_envelopeTypeName = @"Microsoft.ApplicationInsights.Domain";
_dataTypeName = @"Domain";
}

View File

@@ -7,7 +7,7 @@
/// Initializes a new instance of the class.
- (instancetype)init {
if(self = [super init]) {
if((self = [super init])) {
_version = @1;
_sampleRate = @100.0;
_tags = [NSDictionary dictionary];

View File

@@ -44,7 +44,7 @@
@interface BITFeedbackActivity()
@property (nonatomic, strong) NSMutableArray *items;
@property (nonatomic, strong) UIViewController *activityViewController;
@property (nonatomic, strong, readwrite) UIViewController *activityViewController;
@end

View File

@@ -437,8 +437,8 @@
#pragma mark - UIViewController Rotation
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) __unused orientation {
return YES;
- (UIInterfaceOrientationMask)supportedInterfaceOrientations{
return UIInterfaceOrientationMaskAll;
}
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation) __unused fromInterfaceOrientation {

View File

@@ -426,11 +426,10 @@
[super willRotateToInterfaceOrientation:toInterfaceOrientation duration:duration];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) __unused orientation {
return YES;
- (UIInterfaceOrientationMask)supportedInterfaceOrientations{
return UIInterfaceOrientationMaskAll;
}
#pragma mark - Table view data source
- (NSInteger)numberOfSectionsInTableView:(UITableView *) __unused tableView {

View File

@@ -43,7 +43,7 @@
@property (nonatomic, readonly) NSData *data;
@property (readonly) UIImage *imageRepresentation;
@property (nonatomic, readonly) UIImage *imageRepresentation;
+ (BITFeedbackMessageAttachment *)attachmentWithData:(NSData *)data contentType:(NSString *)contentType;

View File

@@ -96,8 +96,8 @@
#pragma mark - UIViewController Rotation
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) __unused orientation {
return YES;
- (UIInterfaceOrientationMask)supportedInterfaceOrientations{
return UIInterfaceOrientationMaskAll;
}
#pragma mark - Private methods

View File

@@ -38,7 +38,7 @@
hockeyAttachmentData:(NSData *)hockeyAttachmentData
contentType:(NSString *)contentType
{
if (self = [super init]) {
if ((self = [super init])) {
_filename = filename;
_hockeyAttachmentData = hockeyAttachmentData;

View File

@@ -93,21 +93,14 @@
#pragma mark - Rotation
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
BOOL shouldAutorotate;
-(UIInterfaceOrientationMask)supportedInterfaceOrientations {
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
shouldAutorotate = (interfaceOrientation == UIInterfaceOrientationLandscapeLeft ||
interfaceOrientation == UIInterfaceOrientationLandscapeRight ||
interfaceOrientation == UIInterfaceOrientationPortrait);
return (UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscape);
} else {
shouldAutorotate = YES;
return UIInterfaceOrientationMaskAll;
}
return shouldAutorotate;
}
#pragma mark - Modal presentation

View File

@@ -11,7 +11,8 @@ BITLogHandler const defaultLogHandler = ^(BITLogMessageProvider messageProvider,
if (_currentLogLevel < logLevel) {
return;
}
NSLog((@"[HockeySDK] %s/%d %@"), function, line, messageProvider());
NSString *functionString = [NSString stringWithUTF8String:function];
NSLog((@"[HockeySDK] %@/%d %@"), functionString, line, messageProvider());
}
};

View File

@@ -174,7 +174,7 @@ static NSUInteger const BITDefaultFileCount = 50;
filePath = [self.appHockeySDKDirectoryPath stringByAppendingPathComponent:kBITMetaDataDirectory];
break;
};
default: {
case BITPersistenceTypeTelemetry: {
NSString *uuid = bit_UUID();
fileName = [NSString stringWithFormat:@"%@%@", kBITFileBaseString, uuid];
filePath = [self.appHockeySDKDirectoryPath stringByAppendingPathComponent:kBITTelemetryDirectory];

View File

@@ -8,7 +8,7 @@
/// Initializes a new instance of the class.
- (instancetype)init {
if(self = [super init]) {
if((self = [super init])) {
_envelopeTypeName = @"Microsoft.ApplicationInsights.SessionState";
_dataTypeName = @"SessionStateData";
_version = @2;

View File

@@ -21,7 +21,7 @@ static char *const BITContextOperationsQueue = "net.hockeyapp.telemetryContextQu
-(instancetype)init {
if(self = [super init]) {
if((self = [super init])) {
_operationsQueue = dispatch_queue_create(BITContextOperationsQueue, DISPATCH_QUEUE_CONCURRENT);
}
return self;

View File

@@ -817,8 +817,6 @@ typedef NS_ENUM(NSInteger, BITUpdateAlertViewTag) {
case BITUpdateCheckManually:
checkForUpdate = NO;
break;
default:
break;
}
return checkForUpdate;

View File

@@ -353,12 +353,13 @@
int i = 0;
BOOL breakAfterThisAppVersion = NO;
for (BITAppVersionMetaInfo *appVersion in self.updateManager.appVersions) {
BITUpdateManager *stronManager = self.updateManager;
for (BITAppVersionMetaInfo *appVersion in stronManager.appVersions) {
i++;
// only show the newer version of the app by default, if we don't show all versions
if (!self.showAllVersions) {
if ([appVersion.version isEqualToString:[self.updateManager currentAppVersion]]) {
if ([appVersion.version isEqualToString:[stronManager currentAppVersion]]) {
if (i == 1) {
breakAfterThisAppVersion = YES;
} else {
@@ -386,12 +387,12 @@
- (void)showPreviousVersionAction {
self.showAllVersions = YES;
BOOL showAllPending = NO;
for (BITAppVersionMetaInfo *appVersion in self.updateManager.appVersions) {
BITUpdateManager *strongManager = self.updateManager;
for (BITAppVersionMetaInfo *appVersion in strongManager.appVersions) {
if (!showAllPending) {
if ([appVersion.version isEqualToString:[self.updateManager currentAppVersion]]) {
if ([appVersion.version isEqualToString:[strongManager currentAppVersion]]) {
showAllPending = YES;
if (appVersion == self.updateManager.newestAppVersion) {
if (appVersion == strongManager.newestAppVersion) {
continue; // skip this version already if it the latest version is the installed one
}
} else {
@@ -513,12 +514,13 @@
}
- (void)storeButtonFired:(BITStoreButton *) __unused button {
BITUpdateManager *strongManager = self.updateManager;
switch (self.appStoreButtonState) {
case AppStoreButtonStateCheck:
[self.updateManager checkForUpdateShowFeedback:YES];
[strongManager checkForUpdateShowFeedback:YES];
break;
case AppStoreButtonStateUpdate:
if ([self.updateManager initiateAppDownload]) {
if ([strongManager initiateAppDownload]) {
[self setAppStoreButtonState:AppStoreButtonStateInstalling animated:YES];
};
break;

View File

@@ -162,16 +162,13 @@ body { font: 13px 'Helvetica Neue', Helvetica; color:#626262; word-wrap:break-wo
case UIWebViewNavigationTypeLinkClicked:
[self openURL:request.URL];
return NO;
break;
case UIWebViewNavigationTypeOther:
return YES;
break;
case UIWebViewNavigationTypeBackForward:
case UIWebViewNavigationTypeFormResubmitted:
case UIWebViewNavigationTypeFormSubmitted:
case UIWebViewNavigationTypeReload:
return NO;
break;
}
}