Delete _strnicmp. Uses replaced with abseil functions.

The replacements are absl::EqualsIgnoreCase and
absl::StartsWithIgnoreCase. Also delete the alias
RtpUtility::StringCompare.

Bug: webrtc:6424
Change-Id: I4bed71540264450f85137ad0c2564125c5c6213f
Reviewed-on: https://webrtc-review.googlesource.com/c/109006
Commit-Queue: Niels Moller <nisse@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25481}
This commit is contained in:
Niels Möller
2018-11-02 10:54:56 +01:00
committed by Commit Bot
parent 41f00de26b
commit aa3c1cc927
11 changed files with 44 additions and 57 deletions

View File

@ -16,6 +16,7 @@
#include <utility>
#include "absl/memory/memory.h"
#include "absl/strings/match.h"
#include "logging/rtc_event_log/events/rtc_event_rtp_packet_outgoing.h"
#include "logging/rtc_event_log/rtc_event_log.h"
#include "modules/remote_bitrate_estimator/test/bwe_test_logging.h"
@ -272,12 +273,11 @@ int32_t RTPSender::DeregisterRtpHeaderExtension(RTPExtensionType type) {
return rtp_header_extension_map_.Deregister(type);
}
int32_t RTPSender::RegisterPayload(
const char payload_name[RTP_PAYLOAD_NAME_SIZE],
int8_t payload_number,
uint32_t frequency,
size_t channels,
uint32_t rate) {
int32_t RTPSender::RegisterPayload(const char* payload_name,
int8_t payload_number,
uint32_t frequency,
size_t channels,
uint32_t rate) {
RTC_DCHECK_LT(strlen(payload_name), RTP_PAYLOAD_NAME_SIZE);
rtc::CritScope lock(&send_critsect_);
@ -290,8 +290,7 @@ int32_t RTPSender::RegisterPayload(
RTC_DCHECK(payload);
// Check if it's the same as we already have.
if (RtpUtility::StringCompare(payload->name, payload_name,
RTP_PAYLOAD_NAME_SIZE - 1)) {
if (absl::EqualsIgnoreCase(payload->name, payload_name)) {
if (audio_configured_ && payload->typeSpecific.is_audio()) {
auto& p = payload->typeSpecific.audio_payload();
if (rtc::SafeEq(p.format.clockrate_hz, frequency) &&

View File

@ -14,6 +14,7 @@
#include <memory>
#include <utility>
#include "absl/strings/match.h"
#include "api/audio_codecs/audio_format.h"
#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
#include "modules/rtp_rtcp/source/byte_io.h"
@ -31,14 +32,13 @@ RTPSenderAudio::RTPSenderAudio(Clock* clock, RTPSender* rtp_sender)
RTPSenderAudio::~RTPSenderAudio() {}
int32_t RTPSenderAudio::RegisterAudioPayload(
const char payloadName[RTP_PAYLOAD_NAME_SIZE],
const int8_t payload_type,
const uint32_t frequency,
const size_t channels,
const uint32_t rate,
RtpUtility::Payload** payload) {
if (RtpUtility::StringCompare(payloadName, "cn", 2)) {
int32_t RTPSenderAudio::RegisterAudioPayload(const char* payloadName,
const int8_t payload_type,
const uint32_t frequency,
const size_t channels,
const uint32_t rate,
RtpUtility::Payload** payload) {
if (absl::EqualsIgnoreCase(payloadName, "cn")) {
rtc::CritScope cs(&send_audio_critsect_);
// we can have multiple CNG payload types
switch (frequency) {
@ -57,7 +57,7 @@ int32_t RTPSenderAudio::RegisterAudioPayload(
default:
return -1;
}
} else if (RtpUtility::StringCompare(payloadName, "telephone-event", 15)) {
} else if (absl::EqualsIgnoreCase(payloadName, "telephone-event")) {
rtc::CritScope cs(&send_audio_critsect_);
// Don't add it to the list
// we dont want to allow send with a DTMF payloadtype

View File

@ -31,7 +31,7 @@ class RTPSenderAudio {
RTPSenderAudio(Clock* clock, RTPSender* rtp_sender);
~RTPSenderAudio();
int32_t RegisterAudioPayload(const char payloadName[RTP_PAYLOAD_NAME_SIZE],
int32_t RegisterAudioPayload(const char* payloadName,
int8_t payload_type,
uint32_t frequency,
size_t channels,

View File

@ -19,6 +19,7 @@
#include <vector>
#include "absl/memory/memory.h"
#include "absl/strings/match.h"
#include "api/crypto/frameencryptorinterface.h"
#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
#include "modules/rtp_rtcp/source/byte_io.h"
@ -152,18 +153,18 @@ VideoCodecType RTPSenderVideo::VideoCodecType() const {
// Static.
RtpUtility::Payload* RTPSenderVideo::CreateVideoPayload(
const char payload_name[RTP_PAYLOAD_NAME_SIZE],
const char* payload_name,
int8_t payload_type) {
enum VideoCodecType video_type = kVideoCodecGeneric;
if (RtpUtility::StringCompare(payload_name, "VP8", 3)) {
if (absl::EqualsIgnoreCase(payload_name, "VP8")) {
video_type = kVideoCodecVP8;
} else if (RtpUtility::StringCompare(payload_name, "VP9", 3)) {
} else if (absl::EqualsIgnoreCase(payload_name, "VP9")) {
video_type = kVideoCodecVP9;
} else if (RtpUtility::StringCompare(payload_name, "H264", 4)) {
} else if (absl::EqualsIgnoreCase(payload_name, "H264")) {
video_type = kVideoCodecH264;
} else if (RtpUtility::StringCompare(payload_name, "I420", 4)) {
} else if (absl::EqualsIgnoreCase(payload_name, "I420")) {
video_type = kVideoCodecGeneric;
} else if (RtpUtility::StringCompare(payload_name, "stereo", 6)) {
} else if (absl::EqualsIgnoreCase(payload_name, "stereo")) {
video_type = kVideoCodecGeneric;
} else {
video_type = kVideoCodecGeneric;

View File

@ -43,10 +43,6 @@ enum {
* Misc utility routines
*/
bool StringCompare(const char* str1, const char* str2, const uint32_t length) {
return _strnicmp(str1, str2, length) == 0;
}
size_t Word32Align(size_t size) {
uint32_t remainder = size % 4;
if (remainder != 0)

View File

@ -34,8 +34,6 @@ struct Payload {
PayloadUnion typeSpecific;
};
bool StringCompare(const char* str1, const char* str2, const uint32_t length);
// Round up to the nearest size that is a multiple of 4.
size_t Word32Align(size_t size);