Commit d01d9fb6 authored by Yuwei Huang's avatar Yuwei Huang Committed by Commit Bot

[CRD iOS] Fix warnings from clang static analyzer

This CL fixes a few warnings reported by the clang static analyzer:
* Remove the unnecessary `next_frame += bytes_to_copy` line from
  AudioPlayerBuffer.
* Call dictionaryWithDictionary with empty dictionary if data is nil.
* Add [super viewDidLoad] calls to view controllers.

Note that none of them causes actual problem in the official app.

Bug: 791222
Change-Id: Icaaf8a43481eb68950dbf6c25c9d7789237aed5e
Reviewed-on: https://chromium-review.googlesource.com/809928
Commit-Queue: Yuwei Huang <yuweih@chromium.org>
Reviewed-by: default avatarJamie Walch <jamiewalch@chromium.org>
Cr-Commit-Position: refs/heads/master@{#522216}
parent d7f89a76
......@@ -166,7 +166,6 @@ void AudioPlayerBuffer::ProcessFrameRequestQueue() {
memcpy(next_frame, packet_data.data() + bytes_consumed_, bytes_to_copy);
next_frame += bytes_to_copy;
bytes_consumed_ += bytes_to_copy;
activeRequest->bytes_extracted_ += bytes_to_copy;
queued_bytes_ -= bytes_to_copy;
......
......@@ -32,6 +32,8 @@
}
- (void)viewDidLoad {
[super viewDidLoad];
[self addChildViewController:_mainViewController];
[self.view addSubview:_mainViewController.view];
[_mainViewController didMoveToParentViewController:self];
......
......@@ -31,6 +31,8 @@ static const float kButtonHeight = 80.f;
#pragma mark - UIViewController
- (void)viewDidLoad {
[super viewDidLoad];
UIImageView* imageView = [[UIImageView alloc]
initWithImage:[UIImage imageNamed:@"launchscreen_app_logo"]];
imageView.translatesAutoresizingMaskIntoConstraints = NO;
......
......@@ -41,6 +41,8 @@ static const CGFloat kButtonBottomPaddingAdjustment = -5;
}
- (void)viewDidLoad {
[super viewDidLoad];
UIView* contentView = [[UIView alloc] initWithFrame:CGRectZero];
contentView.backgroundColor = RemotingTheme.setupListBackgroundColor;
contentView.translatesAutoresizingMaskIntoConstraints = NO;
......
......@@ -17,6 +17,8 @@ static const CGFloat kActivityIndicatorRadius = 20.f;
@implementation HostFetchingViewController
- (void)viewDidLoad {
[super viewDidLoad];
MDCActivityIndicator* activityIndicator = [[MDCActivityIndicator alloc] init];
activityIndicator.translatesAutoresizingMaskIntoConstraints = NO;
activityIndicator.cycleColors = @[ RemotingTheme.refreshIndicatorColor ];
......
......@@ -125,13 +125,12 @@ NSString* const kKeychainPairingSecret = @"kKeychainPairingSecret";
if (mapString &&
[mapString respondsToSelector:@selector(dataUsingEncoding:)]) {
NSData* data = [mapString dataUsingEncoding:NSUTF8StringEncoding];
NSDictionary* pairingMap;
if (data) {
pairingMap = (NSDictionary*)[NSJSONSerialization
NSDictionary* pairingMap =
data ? (NSDictionary*)[NSJSONSerialization
JSONObjectWithData:data
options:NSJSONReadingMutableContainers
error:&err];
}
error:&err]
: @{};
if (!err) {
return [NSMutableDictionary dictionaryWithDictionary:pairingMap];
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment