Skip to content

Commit

Permalink
Merge pull request openedx-unsupported#116 from edx/aleffert/analyzer…
Browse files Browse the repository at this point in the history
…-errors

Enable the Static Analyzer on build and fix all warnings
  • Loading branch information
aleffert committed Mar 23, 2015
2 parents 49b3bd8 + 4b39309 commit a800f99
Show file tree
Hide file tree
Showing 19 changed files with 34 additions and 30 deletions.
9 changes: 5 additions & 4 deletions edXVideoLocker.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,6 @@
B498407A19753C7B00019D1F /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = B498406B19753C7B00019D1F /* [email protected] */; };
B49A390B1975919C00850002 /* OEXCustomSlider.m in Sources */ = {isa = PBXBuildFile; fileRef = B49A390A1975919C00850002 /* OEXCustomSlider.m */; };
B4A24D0D19EE8A6600CE5010 /* CoreMedia.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B4A24D0C19EE8A6600CE5010 /* CoreMedia.framework */; };
B4A9EA231966A2FA00AAB3DB /* NSObject+OEXReplaceNull.m in Sources */ = {isa = PBXBuildFile; fileRef = B4A9EA221966A2FA00AAB3DB /* NSObject+OEXReplaceNull.m */; };
B4B285D01A97240200DD603A /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = B4B285CE1A97240200DD603A /* [email protected] */; };
B4B285D11A97240200DD603A /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = B4B285CF1A97240200DD603A /* [email protected] */; };
B4B285D91A9A48D500DD603A /* OEXGoogleConfig.m in Sources */ = {isa = PBXBuildFile; fileRef = B4B285D81A9A48D500DD603A /* OEXGoogleConfig.m */; };
Expand Down Expand Up @@ -1785,7 +1784,7 @@
BECB7B031924C0C3009C77F1 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0510;
LastUpgradeCheck = 0620;
ORGANIZATIONNAME = edX;
TargetAttributes = {
BECB7B0A1924C0C3009C77F1 = {
Expand Down Expand Up @@ -2152,8 +2151,7 @@
199627A71945D95D0022C489 /* OEXFrontTableViewCell.m in Sources */,
1913DD3D194B267000573977 /* OEXDownloadViewController.m in Sources */,
7764597F1A096339008404CC /* NSString+OEXEncoding.m in Sources */,
B4A9EA231966A2FA00AAB3DB /* NSObject+OEXReplaceNull.m in Sources */,
B4A9EA231966A2FA00AAB3DB /* NSObject+OEXReplaceNull.m in Sources */,
77DC295E1ABC9D4400FAD22C /* NSObject+OEXReplaceNull.m in Sources */,
B4B6D6031A949EFC000F44E8 /* OEXRegistrationOption.m in Sources */,
770A279D1A6F150B00DFC6FF /* OEXVideoPathEntry.m in Sources */,
B4B6D6161A949F0F000F44E8 /* OEXRegistrationFieldEmailView.m in Sources */,
Expand Down Expand Up @@ -2286,6 +2284,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 7.1;
ONLY_ACTIVE_ARCH = YES;
PRODUCT_NAME = edX;
RUN_CLANG_STATIC_ANALYZER = YES;
SDKROOT = iphoneos;
};
name = Coverage;
Expand Down Expand Up @@ -2375,6 +2374,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 7.1;
ONLY_ACTIVE_ARCH = YES;
PRODUCT_NAME = edX;
RUN_CLANG_STATIC_ANALYZER = YES;
SDKROOT = iphoneos;
};
name = Debug;
Expand Down Expand Up @@ -2411,6 +2411,7 @@
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 7.1;
PRODUCT_NAME = edX;
RUN_CLANG_STATIC_ANALYZER = YES;
SDKROOT = iphoneos;
VALIDATE_PRODUCT = YES;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0610"
LastUpgradeVersion = "0620"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down Expand Up @@ -76,6 +76,15 @@
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "BECB7B2B1924C0C3009C77F1"
BuildableName = "edXVideoLockerTests.xctest"
BlueprintName = "edXVideoLockerTests"
ReferencedContainer = "container:edXVideoLocker.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
Expand Down
1 change: 0 additions & 1 deletion edXVideoLocker/CutomePlayer/CLPortraitOptionsView.m
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,6 @@ - (void)setPersistedLanguage {
break;
}
if(i == [self.arr_Values count] - 1) {
strLanguage = @"";
return;
}
}
Expand Down
6 changes: 1 addition & 5 deletions edXVideoLocker/CutomePlayer/CLVideoPlayerControls.m
Original file line number Diff line number Diff line change
Expand Up @@ -421,8 +421,7 @@ - (void)callPortraitSubtitles:(NSNotification*)notification {
self.btnSettings.selected = NO;
[_btnSettings setImage:[UIImage imageNamed:@"ic_settings.png"] forState:UIControlStateNormal];

NSString* Key = [[NSString alloc] init];
Key = [[dict allKeys] lastObject];
NSString* Key = [[dict allKeys] lastObject];

if([Key isEqualToString:KEY_SET_PLAYBACKSPEED]) {
NSString* oldSpeed = [NSString stringWithFormat:@"%.1f", self.playbackRate];
Expand Down Expand Up @@ -883,7 +882,6 @@ - (void)setPersistedLanguage {
break;
}
if(i == [self.arr_Values count] - 1) {
strLanguage = @"";
return;
}
}
Expand Down Expand Up @@ -1927,8 +1925,6 @@ - (void)setDefaultPlaybackSpeed {
- (void)moviePlaybackStateDidChange:(NSNotification*)note {
__weak CLVideoPlayerControls* weakSelf = self;

NSString* strLanguage = [[NSString alloc] init];
strLanguage = [OEXInterface getCCSelectedLanguage];
switch(weakSelf.moviePlayer.playbackState)
{
case MPMoviePlaybackStateStopped:
Expand Down
1 change: 1 addition & 0 deletions edXVideoLocker/OEXCourseInfoTabViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ -(void)computeBlurredCourseImage {
dispatch_async(dispatch_get_main_queue(), ^{
self.img_Course.image = blurredImage;
});
CGImageRelease(cgImage);
}

-(void)addAnnouncementsWebView {
Expand Down
1 change: 1 addition & 0 deletions edXVideoLocker/OEXCourseVideoDownloadTableViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ - (void)viewWillAppear:(BOOL)animated {
}

- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
if(self.navigationController.topViewController != self) {
[[CLPortraitOptionsView sharedInstance] removeSelfFromSuperView];

Expand Down
1 change: 1 addition & 0 deletions edXVideoLocker/OEXCustomTabBarViewViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ - (id)initWithNibName:(NSString*)nibNameOrNil bundle:(NSBundle*)nibBundleOrNil {
}

-(void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
[self removeObserver];
}

Expand Down
2 changes: 2 additions & 0 deletions edXVideoLocker/OEXDownloadViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ - (void)reachabilityDidChange:(NSNotification*)notification {
}

-(void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
[[NSNotificationCenter defaultCenter] removeObserver:self name:DOWNLOAD_PROGRESS_NOTIFICATION object:nil];
[[NSNotificationCenter defaultCenter] removeObserver:self name:VIDEO_DL_COMPLETE object:nil];
[[NSNotificationCenter defaultCenter] removeObserver:self name:kReachabilityChangedNotification object:nil];
Expand All @@ -123,6 +124,7 @@ - (void)viewWillAppear:(BOOL)animated {
}

-(void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
[self downloadCompleteNotification:nil];
}

Expand Down
1 change: 1 addition & 0 deletions edXVideoLocker/OEXFrontCourseViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ -(void)viewWillAppear:(BOOL)animated {
}

-(void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
self.view.userInteractionEnabled = YES;
[self showHideOfflineModeView];
}
Expand Down
11 changes: 0 additions & 11 deletions edXVideoLocker/OEXGenericCourseTableViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ - (void)viewDidLoad {
//Add oserver

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateTotalDownloadProgress:) name:TOTAL_DL_PROGRESS object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(showFloatingView:) name:FL_MESSAGE object:nil];

[[self.dataInterface progressViews] addObject:self.customProgressBar];
[[self.dataInterface progressViews] addObject:self.btn_Downloads];
Expand All @@ -187,16 +186,6 @@ - (void)viewDidLoad {

#pragma update total download progress

-(void)showFloatingView:(NSNotification* )notification {
NSDictionary* progress = (NSDictionary*)notification.userInfo;

NSArray* array = [progress objectForKey:FL_ARRAY];
NSString* sString = @"";
if(array.count > 1) {
sString = OEXLocalizedString(@"s", nil);
}
}

-(void)updateTotalDownloadProgress:(NSNotification* )notification {
[self.customProgressBar setProgress:_dataInterface.totalProgress animated:YES];
[self performSelector:@selector(reloadTableOnMainThread) withObject:nil afterDelay:1.5];
Expand Down
3 changes: 1 addition & 2 deletions edXVideoLocker/OEXInterface.m
Original file line number Diff line number Diff line change
Expand Up @@ -1211,8 +1211,7 @@ - (NSString*)getFormattedDate {
NSDate* date = [NSDate date];
NSDateFormatter* format = [[NSDateFormatter alloc] init];
[format setDateFormat:@"YYYY-MM-dd HH:mm:ss.SSSSSSZ"];
NSString* strdate = [[NSString alloc] init];
strdate = [format stringFromDate:date];
NSString* strdate = [format stringFromDate:date];

NSString* substringFirst = [strdate substringToIndex:29];
NSString* substringsecond = [strdate substringFromIndex:29];
Expand Down
4 changes: 1 addition & 3 deletions edXVideoLocker/OEXLoginViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ - (id)initWithNibName:(NSString*)nibNameOrNil bundle:(NSBundle*)nibBundleOrNil {
}

-(void) viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
[[NSNotificationCenter defaultCenter] removeObserver:self];
[self.view setUserInteractionEnabled:NO];

Expand All @@ -272,9 +273,6 @@ -(void) viewWillDisappear:(BOOL)animated {
}
}

-(void)viewDidAppear:(BOOL)animated {
}

- (void)hideOverlay {
self.imgOverlay.hidden = YES;
}
Expand Down
1 change: 1 addition & 0 deletions edXVideoLocker/OEXMyVideosSubSectionViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -805,6 +805,7 @@ -(void)dealloc {
}

- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
if(self.navigationController.topViewController != self) {
[[CLPortraitOptionsView sharedInstance] removeSelfFromSuperView];
[self.videoPlayerInterface.moviePlayerController pause];
Expand Down
2 changes: 1 addition & 1 deletion edXVideoLocker/OEXMyVideosViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -1217,7 +1217,7 @@ -(void)dealloc {
}

- (void)viewWillDisappear:(BOOL)animated {
//NSLog(@"DEALLOC my videos");
[super viewWillDisappear:animated];
if(self.navigationController.topViewController != self) {
[[CLPortraitOptionsView sharedInstance] removeSelfFromSuperView];
[self.videoPlayerInterface.moviePlayerController pause];
Expand Down
1 change: 1 addition & 0 deletions edXVideoLocker/OEXRearTableViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ - (void)pop {
}

-(void)viewDidDisappear:(BOOL)animated {
[super viewDidDisappear:animated];
[self.view setUserInteractionEnabled:YES];
}

Expand Down
1 change: 1 addition & 0 deletions edXVideoLocker/OEXRegistrationViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ -(void)viewWillAppear:(BOOL)animated {
}

-(void)viewDidDisappear:(BOOL)animated {
[super viewDidDisappear:animated];
// This will remove observer for keyboard
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
Expand Down
2 changes: 2 additions & 0 deletions edXVideoLocker/OEXUserLicenseAgreementViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,12 @@ - (void)viewDidLoad {
}

-(void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[UIApplication sharedApplication].statusBarHidden = YES;
}

-(void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
[UIApplication sharedApplication].statusBarHidden = NO;
}

Expand Down
2 changes: 2 additions & 0 deletions edXVideoLocker/OEXVideoPlayerInterface.m
Original file line number Diff line number Diff line change
Expand Up @@ -205,12 +205,14 @@ -(void)willResignActive:(NSNotification*)notification {
}

-(void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
[NSObject cancelPreviousPerformRequestsWithTarget:self];
[_moviePlayerController setShouldAutoplay:NO];
_shouldRotate = NO;
}

-(void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[_moviePlayerController setShouldAutoplay:YES];
_shouldRotate = YES;
}
Expand Down
4 changes: 2 additions & 2 deletions edXVideoLockerTests/NSString+OEXFormattingTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ - (void)testFormatMultipleReplacement {

- (void)testMissingArgument {
NSString* format = @"{param} {arg} with {param} {arg} in it";
XCTAssertThrowsSpecific([NSString oex_stringWithFormat:format parameters:@{@"param" : @"some"}], NSException);
XCTAssertThrows([NSString oex_stringWithFormat:format parameters:@{@"param" : @"some"}]);
}

- (void)testExtraParameter {
NSString* format = @"{arg} some text";
XCTAssertThrowsSpecific([NSString oex_stringWithFormat:format parameters:@{}], NSException);
XCTAssertThrows([NSString oex_stringWithFormat:format parameters:@{}]);
}

#endif
Expand Down

0 comments on commit a800f99

Please sign in to comment.