Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(954)

Issue 2534683002: RTC_[D]CHECK_op: Remove superfluous casts (Closed)

Created:
4 years ago by kwiberg-webrtc
Modified:
4 years ago
Reviewers:
ossu
CC:
webrtc-reviews_webrtc.org, yujie_mao (webrtc), zhuangzesen_agora.io, tlegrand-webrtc, qiang.lu, peah-webrtc, bjornv1, video-team_agora.io, tterriberry_mozilla.com, sdk-team_agora.io, minyue-webrtc, mflodman, Andrew MacDonald, zhengzhonghou_agora.io, stefan-webrtc, kwiberg-webrtc, danilchap, henrika_webrtc, audio-team_agora.io, hlundin-webrtc, niklas.enbom, the sun, aluebs-webrtc
Target Ref:
refs/pending/heads/master
Project:
webrtc
Visibility:
Public.

Description

RTC_[D]CHECK_op: Remove superfluous casts There's no longer any need to make the two arguments have the same signedness, so we can remove a bunch of superfluous (and sometimes dangerous) casts. It turned out I also had to fix the safe_cmp functions to properly handle enums that are implicitly convertible to integers. NOPRESUBMIT=true BUG=webrtc:6645 Committed: https://crrev.com/352444fcace861c0b0e2b1654187f5244e1be1f4 Cr-Commit-Position: refs/heads/master@{#15281}

Patch Set 1 : test #

Total comments: 3
Unified diffs Side-by-side diffs Delta from patch set Stats (+140 lines, -74 lines) Patch
M webrtc/audio/audio_transport_proxy.cc View 1 chunk +3 lines, -4 lines 0 comments Download
M webrtc/base/checks.h View 1 chunk +1 line, -2 lines 0 comments Download
M webrtc/base/file_posix.cc View 1 chunk +1 line, -1 line 0 comments Download
M webrtc/base/random_unittest.cc View 1 chunk +1 line, -1 line 0 comments Download
M webrtc/base/safe_compare.h View 1 chunk +73 lines, -18 lines 3 comments Download
M webrtc/base/safe_compare_unittest.cc View 1 chunk +15 lines, -0 lines 0 comments Download
M webrtc/base/stringutils.cc View 2 chunks +2 lines, -2 lines 0 comments Download
M webrtc/base/task_queue_win.cc View 1 chunk +1 line, -1 line 0 comments Download
M webrtc/common_types.cc View 2 chunks +5 lines, -5 lines 0 comments Download
M webrtc/modules/audio_coding/codecs/cng/audio_encoder_cng.cc View 1 chunk +1 line, -1 line 0 comments Download
M webrtc/modules/audio_coding/codecs/cng/webrtc_cng.cc View 1 chunk +1 line, -1 line 0 comments Download
M webrtc/modules/audio_coding/neteq/dtmf_tone_generator.cc View 2 chunks +5 lines, -5 lines 0 comments Download
M webrtc/modules/audio_coding/neteq/normal.cc View 1 chunk +1 line, -1 line 0 comments Download
M webrtc/modules/audio_device/android/audio_track_jni.cc View 1 chunk +1 line, -1 line 0 comments Download
M webrtc/modules/audio_device/fine_audio_buffer.cc View 1 chunk +1 line, -1 line 0 comments Download
M webrtc/modules/audio_processing/aec/aec_core.cc View 2 chunks +3 lines, -4 lines 0 comments Download
M webrtc/modules/audio_processing/level_controller/down_sampler.cc View 1 chunk +4 lines, -5 lines 0 comments Download
M webrtc/modules/audio_processing/level_controller/signal_classifier.cc View 1 chunk +1 line, -1 line 0 comments Download
M webrtc/modules/audio_processing/vad/voice_activity_detector.cc View 1 chunk +1 line, -1 line 0 comments Download
M webrtc/modules/rtp_rtcp/source/forward_error_correction.cc View 1 chunk +1 line, -1 line 0 comments Download
M webrtc/modules/rtp_rtcp/source/rtcp_sender.cc View 6 chunks +6 lines, -6 lines 0 comments Download
M webrtc/modules/video_coding/codecs/h264/h264_encoder_impl.cc View 2 chunks +2 lines, -2 lines 0 comments Download
M webrtc/modules/video_coding/codecs/vp8/vp8_impl.cc View 1 chunk +2 lines, -2 lines 0 comments Download
M webrtc/modules/video_coding/codecs/vp9/vp9_impl.cc View 1 chunk +2 lines, -2 lines 0 comments Download
M webrtc/modules/video_coding/video_codec_initializer.cc View 1 chunk +1 line, -1 line 0 comments Download
M webrtc/pc/mediasession.cc View 1 chunk +1 line, -1 line 0 comments Download
M webrtc/test/fake_network_pipe_unittest.cc View 1 chunk +1 line, -1 line 0 comments Download
M webrtc/test/layer_filtering_transport.cc View 1 chunk +1 line, -1 line 0 comments Download
M webrtc/test/rtcp_packet_parser.h View 1 chunk +1 line, -1 line 0 comments Download
M webrtc/video/video_quality_test.cc View 1 chunk +1 line, -1 line 0 comments Download

Depends on Patchset:

Dependent Patchsets:

Messages

Total messages: 23 (16 generated)
kwiberg-webrtc
This should be the final CL for this bug!
4 years ago (2016-11-26 23:01:44 UTC) #13
ossu
I've only one question, mainly because I'm interested. I don't think it's reason enough to ...
4 years ago (2016-11-28 14:14:34 UTC) #14
kwiberg-webrtc
https://codereview.webrtc.org/2534683002/diff/40001/webrtc/base/safe_compare.h File webrtc/base/safe_compare.h (right): https://codereview.webrtc.org/2534683002/diff/40001/webrtc/base/safe_compare.h#newcode164 webrtc/base/safe_compare.h:164: static char Test(...); On 2016/11/28 14:14:34, ossu wrote: > ...
4 years ago (2016-11-28 23:20:37 UTC) #15
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.webrtc.org/2534683002/40001
4 years ago (2016-11-28 23:27:52 UTC) #17
commit-bot: I haz the power
Committed patchset #1 (id:40001)
4 years ago (2016-11-28 23:58:58 UTC) #20
commit-bot: I haz the power
Patchset 1 (id:??) landed as https://crrev.com/352444fcace861c0b0e2b1654187f5244e1be1f4 Cr-Commit-Position: refs/heads/master@{#15281}
4 years ago (2016-11-28 23:59:09 UTC) #22
ossu
4 years ago (2016-11-29 10:28:23 UTC) #23
Message was sent while issue was closed.
https://codereview.webrtc.org/2534683002/diff/40001/webrtc/base/safe_compare.h
File webrtc/base/safe_compare.h (right):

https://codereview.webrtc.org/2534683002/diff/40001/webrtc/base/safe_compare....
webrtc/base/safe_compare.h:164: static char Test(...);
On 2016/11/28 23:20:37, kwiberg-webrtc wrote:
> On 2016/11/28 14:14:34, ossu wrote:
> > I tried to find an answer to this, and clearly this isn't the case on any of
> our
> > current platforms, but could char and int be the same type? I guess they
could
> > be the same size on some machine that only reads words, but would that also
> mean
> > they're the same type? If so, the check below would break down.
> 
> Yes, they can be the same size, but I think they'd still be separate types.
You
> can run into problems on real systems today because long long and long,
although
> they're both 64 bits, aren't the same type. Example where the compiler is able
> to tell them apart, even though they're both 64 bits:
> https://godbolt.org/g/rVMNcI

Cool beans! Then I'm satisfied. :)

Powered by Google App Engine
This is Rietveld 408576698