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}
This commit is contained in:
kjellander 2016-06-20 07:04:09 -07:00 committed by Commit bot
parent 839315beca
commit 3e33bfeb6d
5 changed files with 7 additions and 34 deletions

View File

@ -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",

View File

@ -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',

View File

@ -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<uint32_t>(config_.id)) {
Close();
}
}

View File

@ -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]));
}
}

View File

@ -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<uint32_t>(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;