From 3e33bfeb6d4a7b9e14ce856e849f5e0367689e09 Mon Sep 17 00:00:00 2001 From: kjellander Date: Mon, 20 Jun 2016 07:04:09 -0700 Subject: [PATCH] Fix some sign-compare warnings in webrtc/api. The disabling of the warnings doesn't seem to work when Chromium is using our targets (https://codereview.chromium.org/2022833002) so better fix them. BUG=webrtc:4256,webrtc:3307 NOTRY=True Review-Url: https://codereview.webrtc.org/2074423002 Cr-Commit-Position: refs/heads/master@{#13217} --- webrtc/api/BUILD.gn | 11 ++--------- webrtc/api/api.gyp | 22 ---------------------- webrtc/api/datachannel.cc | 3 ++- webrtc/api/videocapturertracksource.cc | 2 +- webrtc/api/webrtcsdp.cc | 3 ++- 5 files changed, 7 insertions(+), 34 deletions(-) diff --git a/webrtc/api/BUILD.gn b/webrtc/api/BUILD.gn index cb3066eae6..442ecbff0c 100644 --- a/webrtc/api/BUILD.gn +++ b/webrtc/api/BUILD.gn @@ -19,11 +19,8 @@ config("libjingle_peerconnection_warnings_config") { # GN orders flags on a target before flags from configs. The default config # adds these flags so to cancel them out they need to come from a config and # cannot be on the target directly. - if (!is_win) { - cflags = [ "-Wno-sign-compare" ] - if (!is_clang) { - cflags += [ "-Wno-maybe-uninitialized" ] # Only exists for GCC. - } + if (!is_win && !is_clang) { + cflags = [ "-Wno-maybe-uninitialized" ] # Only exists for GCC. } } @@ -110,10 +107,6 @@ source_set("libjingle_peerconnection") { configs -= [ "//build/config/clang:find_bad_constructs" ] } - if (is_win) { - cflags += [ "/wd4389" ] # signed/unsigned mismatch. - } - deps = [ "../call", "../media", diff --git a/webrtc/api/api.gyp b/webrtc/api/api.gyp index 8525eb09c7..a3113abf21 100644 --- a/webrtc/api/api.gyp +++ b/webrtc/api/api.gyp @@ -169,11 +169,6 @@ 'webrtcsessiondescriptionfactory.cc', 'webrtcsessiondescriptionfactory.h', ], - # TODO(kjellander): Make the code compile without disabling these flags. - # See https://bugs.chromium.org/p/webrtc/issues/detail?id=3307 - 'cflags': [ - '-Wno-sign-compare', - ], 'conditions': [ ['clang==1', { 'cflags!': [ @@ -187,23 +182,6 @@ '-Wno-maybe-uninitialized', # Only exists for GCC. ], }], - ['OS=="win"', { - # Disable warning for signed/unsigned mismatch. - 'msvs_settings': { - 'VCCLCompilerTool': { - 'AdditionalOptions!': ['/we4389'], - }, - }, - }], - ['OS=="win" and clang==1', { - 'msvs_settings': { - 'VCCLCompilerTool': { - 'AdditionalOptions': [ - '-Wno-sign-compare', - ], - }, - }, - }], ['use_quic==1', { 'dependencies': [ '<(DEPTH)/third_party/libquic/libquic.gyp:libquic', diff --git a/webrtc/api/datachannel.cc b/webrtc/api/datachannel.cc index 5a18e6f1e8..3435fa50d5 100644 --- a/webrtc/api/datachannel.cc +++ b/webrtc/api/datachannel.cc @@ -384,7 +384,8 @@ void DataChannel::OnDataReceived(cricket::DataChannel* channel, } void DataChannel::OnStreamClosedRemotely(uint32_t sid) { - if (data_channel_type_ == cricket::DCT_SCTP && sid == config_.id) { + if (data_channel_type_ == cricket::DCT_SCTP && + sid == static_cast(config_.id)) { Close(); } } diff --git a/webrtc/api/videocapturertracksource.cc b/webrtc/api/videocapturertracksource.cc index 2321d83635..2bef1431de 100644 --- a/webrtc/api/videocapturertracksource.cc +++ b/webrtc/api/videocapturertracksource.cc @@ -314,7 +314,7 @@ void VideoCapturerTrackSource::Initialize( } else { // The VideoCapturer implementation doesn't support capability // enumeration. We need to guess what the camera supports. - for (int i = 0; i < arraysize(kVideoFormats); ++i) { + for (uint32_t i = 0; i < arraysize(kVideoFormats); ++i) { formats.push_back(cricket::VideoFormat(kVideoFormats[i])); } } diff --git a/webrtc/api/webrtcsdp.cc b/webrtc/api/webrtcsdp.cc index b2e75a21cb..0b8d6f6a3d 100644 --- a/webrtc/api/webrtcsdp.cc +++ b/webrtc/api/webrtcsdp.cc @@ -2190,7 +2190,8 @@ void MaybeCreateStaticPayloadAudioCodecs( int payload_type = *it; if (!media_desc->HasCodec(payload_type) && payload_type >= 0 && - payload_type < arraysize(kStaticPayloadAudioCodecs)) { + static_cast(payload_type) < + arraysize(kStaticPayloadAudioCodecs)) { std::string encoding_name = kStaticPayloadAudioCodecs[payload_type].name; int clock_rate = kStaticPayloadAudioCodecs[payload_type].clockrate; size_t channels = kStaticPayloadAudioCodecs[payload_type].channels;